summaryrefslogtreecommitdiffstats
path: root/utils/config.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-06-18 15:31:15 -0400
committerChristopher Speller <crspeller@gmail.com>2015-06-18 15:31:15 -0400
commit16d70995279d7dd2e6e611a321201649334dc91a (patch)
treef54eadbd351e4b89ae3a25f1b80a2a8540dd23b3 /utils/config.go
parent6bc238269353c5641d41c30f8cc46635a9cfe389 (diff)
downloadchat-16d70995279d7dd2e6e611a321201649334dc91a.tar.gz
chat-16d70995279d7dd2e6e611a321201649334dc91a.tar.bz2
chat-16d70995279d7dd2e6e611a321201649334dc91a.zip
If feedback email is not specified then autodetect domain and use feedback@domain
Diffstat (limited to 'utils/config.go')
-rw-r--r--utils/config.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/utils/config.go b/utils/config.go
index 418041706..23bd3e85a 100644
--- a/utils/config.go
+++ b/utils/config.go
@@ -6,6 +6,7 @@ package utils
import (
l4g "code.google.com/p/log4go"
"encoding/json"
+ "net/mail"
"os"
"path/filepath"
)
@@ -222,15 +223,20 @@ func LoadConfig(fileName string) {
config.ServiceSettings.Domain = os.Getenv("MATTERMOST_DOMAIN")
}
- // Validates our mail settings
- if err := CheckMailSettings(); err != nil {
- l4g.Error("Email settings are not valid err=%v", err)
+ // Check for a valid email for feedback, if not then do feedback@domain
+ if _, err := mail.ParseAddress(config.EmailSettings.FeedbackEmail); err != nil {
+ config.EmailSettings.FeedbackEmail = "feedback@" + config.ServiceSettings.Domain
}
configureLog(config.LogSettings)
Cfg = &config
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 {