grafana/pkg/setting/setting_smtp.go

38 lines
1.2 KiB
Go
Raw Normal View History

2015-06-04 07:29:39 -05:00
package setting
type SmtpSettings struct {
Enabled bool
Host string
User string
Password string
CertFile string
KeyFile string
FromAddress string
FromName string
EhloIdentity string
StartTLSPolicy string
SkipVerify bool
2015-06-08 10:56:56 -05:00
SendWelcomeEmailOnSignUp bool
TemplatesPattern string
2015-06-08 10:56:56 -05:00
}
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.StartTLSPolicy = sec.Key("startTLS_policy").String()
cfg.Smtp.SkipVerify = sec.Key("skip_verify").MustBool(false)
2015-06-08 10:56:56 -05:00
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")
2015-06-04 07:29:39 -05:00
}