Initial Baby Step to refactoring settings from global vars to instance (#11777)
* wip: start on refactoring settings * settings: progress on settings refactor * refactor: progress on settings refactoring * fix: fixed failing test * settings: moved smtp settings from global to instance
This commit is contained in:
+15
-15
@@ -16,20 +16,20 @@ type SmtpSettings struct {
|
||||
TemplatesPattern string
|
||||
}
|
||||
|
||||
func readSmtpSettings() {
|
||||
sec := Cfg.Section("smtp")
|
||||
Smtp.Enabled = sec.Key("enabled").MustBool(false)
|
||||
Smtp.Host = sec.Key("host").String()
|
||||
Smtp.User = sec.Key("user").String()
|
||||
Smtp.Password = sec.Key("password").String()
|
||||
Smtp.CertFile = sec.Key("cert_file").String()
|
||||
Smtp.KeyFile = sec.Key("key_file").String()
|
||||
Smtp.FromAddress = sec.Key("from_address").String()
|
||||
Smtp.FromName = sec.Key("from_name").String()
|
||||
Smtp.EhloIdentity = sec.Key("ehlo_identity").String()
|
||||
Smtp.SkipVerify = sec.Key("skip_verify").MustBool(false)
|
||||
func (cfg *Cfg) readSmtpSettings() {
|
||||
sec := cfg.Raw.Section("smtp")
|
||||
cfg.Smtp.Enabled = sec.Key("enabled").MustBool(false)
|
||||
cfg.Smtp.Host = sec.Key("host").String()
|
||||
cfg.Smtp.User = sec.Key("user").String()
|
||||
cfg.Smtp.Password = sec.Key("password").String()
|
||||
cfg.Smtp.CertFile = sec.Key("cert_file").String()
|
||||
cfg.Smtp.KeyFile = sec.Key("key_file").String()
|
||||
cfg.Smtp.FromAddress = sec.Key("from_address").String()
|
||||
cfg.Smtp.FromName = sec.Key("from_name").String()
|
||||
cfg.Smtp.EhloIdentity = sec.Key("ehlo_identity").String()
|
||||
cfg.Smtp.SkipVerify = sec.Key("skip_verify").MustBool(false)
|
||||
|
||||
emails := Cfg.Section("emails")
|
||||
Smtp.SendWelcomeEmailOnSignUp = emails.Key("welcome_email_on_sign_up").MustBool(false)
|
||||
Smtp.TemplatesPattern = emails.Key("templates_pattern").MustString("emails/*.html")
|
||||
emails := cfg.Raw.Section("emails")
|
||||
cfg.Smtp.SendWelcomeEmailOnSignUp = emails.Key("welcome_email_on_sign_up").MustBool(false)
|
||||
cfg.Smtp.TemplatesPattern = emails.Key("templates_pattern").MustString("emails/*.html")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user