Make support mail contact configurable
Still fails because the config is not available in the base template.
This commit is contained in:
parent
d72914da0d
commit
83bc490740
7 changed files with 21 additions and 6 deletions
|
@ -46,6 +46,7 @@ type Config struct {
|
|||
SmtpUseAuth bool // Set whether to use authentication on the smarthosthost
|
||||
SmtpIdentity string // Smarthost username
|
||||
SmtpPassword string // Smarthost password
|
||||
SupportMail string // separate mail address for support contact
|
||||
}
|
||||
SQL struct {
|
||||
Type string // Can be "SQLite" or "Mysql"
|
||||
|
@ -143,6 +144,15 @@ func validateConfig(conf *Config) error {
|
|||
err = fmt.Errorf("Validating config: Mail FromName could not be parsed (%w)", mailFromNameErr)
|
||||
log.Println(err)
|
||||
}
|
||||
supportMail, mailSupportMailErr := mail.ParseAddress(string(conf.Mailer.SupportMail))
|
||||
if !(mailSupportMailErr == nil) {
|
||||
err = fmt.Errorf("Validating config: SupportMail could not be parsed (%w)", mailSupportMailErr)
|
||||
log.Println(err)
|
||||
}
|
||||
if !(supportMail.Name == "") {
|
||||
err = fmt.Errorf("Validating config: SupportMail must not contain a name")
|
||||
log.Println(err)
|
||||
}
|
||||
if !(conf.SQL.Type == "SQLite" || conf.SQL.Type == "Mysql") {
|
||||
err = fmt.Errorf("Validating config: SQL type must be 'SQLite' or 'Mysql', but is '%s'.", conf.SQL.Type)
|
||||
log.Println(err.Error())
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
"smtpPort": 25,
|
||||
"smtpUseAuth": false,
|
||||
"smtpIdentity": "",
|
||||
"smtpPassword": ""
|
||||
"smtpPassword": "",
|
||||
"supportMail": "officeHoursSupport@localhost"
|
||||
},
|
||||
"SQL": {
|
||||
"type": "SQLite",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue