conf: overhaul email settings (#5940)

This commit is contained in:
ᴜɴᴋɴᴡᴏɴ
2020-02-25 00:35:35 +08:00
committed by GitHub
parent 0d6c405ccb
commit 52ffb67b33
21 changed files with 259 additions and 229 deletions

View File

@@ -24,8 +24,8 @@ import (
"gogs.io/gogs/internal/context"
"gogs.io/gogs/internal/cron"
"gogs.io/gogs/internal/db"
"gogs.io/gogs/internal/email"
"gogs.io/gogs/internal/form"
"gogs.io/gogs/internal/mailer"
"gogs.io/gogs/internal/markup"
"gogs.io/gogs/internal/osutil"
"gogs.io/gogs/internal/ssh"
@@ -63,8 +63,12 @@ func GlobalInit(customConf string) error {
log.Trace("Build time: %s", conf.BuildTime)
log.Trace("Build commit: %s", conf.BuildCommit)
if conf.Email.Enabled {
log.Trace("Email service is enabled")
}
conf.NewServices()
mailer.NewContext()
email.NewContext()
if conf.Security.InstallLock {
highlight.NewContext()
@@ -171,10 +175,10 @@ func Install(c *context.Context) {
f.LogRootPath = conf.LogRootPath
// E-mail service settings
if conf.MailService != nil {
f.SMTPHost = conf.MailService.Host
f.SMTPFrom = conf.MailService.From
f.SMTPUser = conf.MailService.User
if conf.Email.Enabled {
f.SMTPHost = conf.Email.Host
f.SMTPFrom = conf.Email.From
f.SMTPUser = conf.Email.User
}
f.RegisterConfirm = conf.Service.RegisterEmailConfirm
f.MailNotify = conf.Service.EnableNotifyMail