diff --git a/cmd/orchid/serve.go b/cmd/orchid/serve.go index 1103851..a3e2524 100644 --- a/cmd/orchid/serve.go +++ b/cmd/orchid/serve.go @@ -14,6 +14,7 @@ import ( "github.com/1f349/violet/utils" "github.com/google/subcommands" _ "github.com/mattn/go-sqlite3" + "github.com/mrmelon54/cdfs" "github.com/mrmelon54/exit-reload" "gopkg.in/yaml.v3" "os" @@ -47,7 +48,7 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, args ...interfa if os.IsNotExist(err) { logger.Logger.Error("Missing config file") } else { - logger.Logger.Error("Open config file: ", "err", err) + logger.Logger.Error("Open config file", "err", err) } return subcommands.ExitFailure } @@ -55,7 +56,7 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, args ...interfa var conf startUpConfig err = yaml.NewDecoder(openConf).Decode(&conf) if err != nil { - logger.Logger.Error("Invalid config file: ", "err", err) + logger.Logger.Error("Invalid config file", "err", err) return subcommands.ExitFailure } @@ -64,7 +65,7 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, args ...interfa return subcommands.ExitSuccess } -//go:embed mail-templates/*.go.* +//go:embed mail-templates/* var mailTemplates embed.FS func normalLoad(conf startUpConfig, wd string) { @@ -74,7 +75,7 @@ func normalLoad(conf startUpConfig, wd string) { logger.Logger.Fatal("Failed to load MJWT verifier public key from file", "path", filepath.Join(wd, "keys"), "err", err) } - mail, err := simplemail.New(&conf.Mail.Mail, "mail", mailTemplates) + mail, err := simplemail.New(&conf.Mail.Mail, wd, cdfs.CD(mailTemplates, "mail-templates")) if err != nil { logger.Logger.Fatal("Failed to load email sender", "err", err) } diff --git a/go.mod b/go.mod index d10b22e..449d163 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/julienschmidt/httprouter v1.3.0 github.com/mattn/go-sqlite3 v1.14.23 github.com/miekg/dns v1.1.62 + github.com/mrmelon54/cdfs v0.0.1 github.com/mrmelon54/certgen v0.0.2 github.com/mrmelon54/exit-reload v0.0.2 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 92c125a..03611f8 100644 --- a/go.sum +++ b/go.sum @@ -91,6 +91,8 @@ github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQ github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ= github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ= +github.com/mrmelon54/cdfs v0.0.1 h1:2rXEG2FyaFCzqTxpQUqAe33qg7elFGtx5t0C40gnZ+0= +github.com/mrmelon54/cdfs v0.0.1/go.mod h1:KabnngCXjgEh5FjfqEuUuuiiHYpxU+Y8lPCgmUDRBYg= github.com/mrmelon54/certgen v0.0.2 h1:4CMDkA/gGZu+E4iikU+5qdOWK7qOQrk58KtUfnmyYmY= github.com/mrmelon54/certgen v0.0.2/go.mod h1:vwrWSXQmxZYqEyh+cf05IvDIFV2aYuxL4+O6ABIlN8M= github.com/mrmelon54/exit-reload v0.0.2 h1:vqgfrMD/bF21HkDsWgg5+NLjFDrD3KGVEN/iTrMn9Ms=