Fix #9151 - smtp logger configuration sendTos should be an array (#9154)

* Fix #9151 - sendTos should be an array

* trimspace from the addresses
This commit is contained in:
zeripath 2019-11-25 13:38:57 +00:00 committed by GitHub
parent 802aa6d5f3
commit f5bd0884d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -131,7 +131,11 @@ func generateLogConfig(sec *ini.Section, name string, defaults defaultLogOptions
logConfig["username"] = sec.Key("USER").MustString("example@example.com") logConfig["username"] = sec.Key("USER").MustString("example@example.com")
logConfig["password"] = sec.Key("PASSWD").MustString("******") logConfig["password"] = sec.Key("PASSWD").MustString("******")
logConfig["host"] = sec.Key("HOST").MustString("127.0.0.1:25") logConfig["host"] = sec.Key("HOST").MustString("127.0.0.1:25")
logConfig["sendTos"] = sec.Key("RECEIVERS").MustString("[]") sendTos := strings.Split(sec.Key("RECEIVERS").MustString(""), ",")
for i, address := range sendTos {
sendTos[i] = strings.TrimSpace(address)
}
logConfig["sendTos"] = sendTos
logConfig["subject"] = sec.Key("SUBJECT").MustString("Diagnostic message from Gitea") logConfig["subject"] = sec.Key("SUBJECT").MustString("Diagnostic message from Gitea")
} }