If feedback email is not specified then autodetect domain and use feedback@domain

Этот коммит содержится в:
Christopher Speller
2015-06-18 15:31:15 -04:00
родитель 11e7b56e78
Коммит dcc09b6991
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@@ -58,7 +58,7 @@
"SMTPPassword": "", "SMTPPassword": "",
"SMTPServer": "localhost:25", "SMTPServer": "localhost:25",
"UseTLS": false, "UseTLS": false,
"FeedbackEmail": "feedback@xxxxxxmustbefilledin.com", "FeedbackEmail": "",
"FeedbackName": "", "FeedbackName": "",
"ApplePushServer": "", "ApplePushServer": "",
"ApplePushCertPublic": "", "ApplePushCertPublic": "",

Просмотреть файл

@@ -6,6 +6,7 @@ package utils
import ( import (
l4g "code.google.com/p/log4go" l4g "code.google.com/p/log4go"
"encoding/json" "encoding/json"
"net/mail"
"os" "os"
"path/filepath" "path/filepath"
) )
@@ -222,15 +223,20 @@ func LoadConfig(fileName string) {
config.ServiceSettings.Domain = os.Getenv("MATTERMOST_DOMAIN") config.ServiceSettings.Domain = os.Getenv("MATTERMOST_DOMAIN")
} }
// Validates our mail settings // Check for a valid email for feedback, if not then do feedback@domain
if err := CheckMailSettings(); err != nil { if _, err := mail.ParseAddress(config.EmailSettings.FeedbackEmail); err != nil {
l4g.Error("Email settings are not valid err=%v", err) config.EmailSettings.FeedbackEmail = "feedback@" + config.ServiceSettings.Domain
} }
configureLog(config.LogSettings) configureLog(config.LogSettings)
Cfg = &config Cfg = &config
SanitizeOptions = getSanitizeOptions() SanitizeOptions = getSanitizeOptions()
// Validates our mail settings
if err := CheckMailSettings(); err != nil {
l4g.Error("Email settings are not valid err=%v", err)
}
} }
func getSanitizeOptions() map[string]bool { func getSanitizeOptions() map[string]bool {