diff options
author | Corey Hulen <corey@hulen.com> | 2015-06-18 11:48:46 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-06-18 11:48:46 -0800 |
commit | 400f55105f0e44183b3d2716917a2bc6de70697c (patch) | |
tree | 81dbd0edc47cb6837e8c97bb2c5cb0034da08498 /utils/config.go | |
parent | aee643e20c8e8350a1137aa69e164218fe5a33f1 (diff) | |
parent | dcc09b69918ec17ebe4727aeca1b887e6a8beefc (diff) | |
download | chat-400f55105f0e44183b3d2716917a2bc6de70697c.tar.gz chat-400f55105f0e44183b3d2716917a2bc6de70697c.tar.bz2 chat-400f55105f0e44183b3d2716917a2bc6de70697c.zip |
Merge pull request #31 from mattermost/feedback-email-auto
HELIUM If feedback email is not specified then autodetect domain and use feedback@domain
Diffstat (limited to 'utils/config.go')
-rw-r--r-- | utils/config.go | 12 |
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 { |