This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: blmayer (bleemayer@gmail.com)
Date: Fri Jan 20 00:50:45 2023 -0300
Parent: 72d1387
Adjusted file init
commit 7444744cddbd432ce8cda986a77ba9282c354274
Author: blmayer <bleemayer@gmail.com>
Date: Fri Jan 20 00:50:45 2023 -0300
Adjusted file init
diff --git a/cmd/dovel/main.go b/cmd/dovel/main.go
index b1a4e15..dc74fd5 100644
--- a/cmd/dovel/main.go
+++ b/cmd/dovel/main.go
@@ -134,6 +134,7 @@ func main() {
mailCfg := file.FileConfig{
Root: hand.Root,
Templates: hand.Templates,
+ Password: os.Getenv("DOVEL_PASS"),
}
funcs := map[string]any{"heading": heading}
mail, err := file.NewFileHandler(mailCfg, funcs)
@@ -146,6 +147,7 @@ func main() {
b.handlers[hand.Domain] = mail.Save
}
+ println("added handler " + hand.Domain + " as " + hand.Handler)
}
s := smtp.NewServer(b)
@@ -159,7 +161,7 @@ func main() {
s.AllowInsecureAuth = true
if cfg.WebPort != nil {
- println("starting web server at " + *cfg.WebPort)
+ println("starting web server at :" + *cfg.WebPort)
go func() {
err = http.ListenAndServe(":"+*cfg.WebPort, nil)
if err != nil {
commit 7444744cddbd432ce8cda986a77ba9282c354274
Author: blmayer <bleemayer@gmail.com>
Date: Fri Jan 20 00:50:45 2023 -0300
Adjusted file init
diff --git a/interfaces/file/file.go b/interfaces/file/file.go
index 6a52728..d5a0300 100644
--- a/interfaces/file/file.go
+++ b/interfaces/file/file.go
@@ -34,15 +34,16 @@ type FileHandler struct {
}
func NewFileHandler(c FileConfig, fs map[string]any) (FileHandler, error) {
- f := FileHandler{root: c.Root}
+ f := FileHandler{root: c.Root, password: c.Password}
fs["inboxes"] = f.Mailboxes
fs["mails"] = f.Mails
fs["mail"] = f.Mail
var err error
- f.templates, err = template.New(c.Root).Funcs(fs).
- ParseGlob(c.Templates + "/*.html")
-
+ if c.Templates != "" {
+ f.templates, err = template.New(c.Root).Funcs(fs).
+ ParseGlob(c.Templates + "/*.html")
+ }
return f, err
}