util: use assets from embeded FS
continuous-integration/drone/push Build was killed
Details
continuous-integration/drone/push Build was killed
Details
This commit is contained in:
parent
f8dfd4e08b
commit
7be1eec9fa
|
@ -14,6 +14,10 @@ var _assets embed.FS
|
|||
|
||||
var Assets http.FileSystem
|
||||
|
||||
func GetEmbedFS() embed.FS {
|
||||
return _assets
|
||||
}
|
||||
|
||||
func init() {
|
||||
sub, err := fs.Sub(_assets, "dist")
|
||||
if err != nil {
|
||||
|
|
|
@ -35,9 +35,12 @@ import (
|
|||
"bytes"
|
||||
"flag"
|
||||
"io"
|
||||
"io/fs"
|
||||
"net/mail"
|
||||
"text/template"
|
||||
|
||||
"git.happydns.org/happydns/ui"
|
||||
|
||||
gomail "github.com/go-mail/mail"
|
||||
"github.com/yuin/goldmark"
|
||||
"github.com/yuin/goldmark/extension"
|
||||
|
@ -135,7 +138,7 @@ func SendMail(to *mail.Address, subject, content string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
if data, err := Asset("htdocs/dist/img/happydns.png"); err != nil {
|
||||
if data, err := fs.ReadFile(ui.GetEmbedFS(), "dist/img/happydns.png"); err != nil {
|
||||
m.EmbedReader("happydns.png", bytes.NewReader(data))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue