1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

ref: embed files, bump to go 1.16 (#167)

* ref: embed portion of files
* fix: readd pkger
* ref: embed version.txt
* fix: wrong mail template import path
* refactor: get rid of sql-migrate
refactor: get rid of pkger in favor of go embed (resolve #164)
* chore: remove unused var [ci-skip]

Co-authored-by: Ferdinand Mütsch <ferdinand@muetsch.io>
This commit is contained in:
Steven Tang
2021-04-11 10:42:43 +00:00
committed by GitHub
parent 2a9fbfdfd7
commit 6256c8e10a
18 changed files with 136 additions and 448 deletions

View File

@ -3,15 +3,15 @@ package mail
import (
"bytes"
"fmt"
"github.com/markbates/pkger"
conf "github.com/muety/wakapi/config"
"github.com/muety/wakapi/services"
"io/ioutil"
"text/template"
conf "github.com/muety/wakapi/config"
"github.com/muety/wakapi/services"
"github.com/muety/wakapi/views"
)
const (
tplPath = "/views/mail"
tplNamePasswordReset = "reset_password"
tplNameImportNotification = "import_finished"
subjectPasswordReset = "Wakapi Password Reset"
@ -66,7 +66,7 @@ func getImportNotificationTemplate(data ImportNotificationTplData) (*bytes.Buffe
}
func loadTemplate(tplName string) (*template.Template, error) {
tplFile, err := pkger.Open(fmt.Sprintf("%s/%s.tpl.html", tplPath, tplName))
tplFile, err := views.TemplateFiles.Open(fmt.Sprintf("mail/%s.tpl.html", tplName))
if err != nil {
return nil, err
}