summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-06-18 11:48:46 -0800
committerCorey Hulen <corey@hulen.com>2015-06-18 11:48:46 -0800
commitd519f678e6d888cbfb06129e31f4ec9eb2a3b64f (patch)
tree5c8d32d1711b35e3d5a2de856e48ce88ad6395d4
parentc64f5eae55e1665681ee7a1b60d3192a54df9f84 (diff)
parent0300c01e0b8a7226592241a2f9c85f4a936cb568 (diff)
downloadchat-d519f678e6d888cbfb06129e31f4ec9eb2a3b64f.tar.gz
chat-d519f678e6d888cbfb06129e31f4ec9eb2a3b64f.tar.bz2
chat-d519f678e6d888cbfb06129e31f4ec9eb2a3b64f.zip
Merge pull request #31 from mattermost/feedback-email-auto
HELIUM If feedback email is not specified then autodetect domain and use feedback@domain
-rw-r--r--config/config_docker.json2
-rw-r--r--utils/config.go12
2 files changed, 10 insertions, 4 deletions
diff --git a/config/config_docker.json b/config/config_docker.json
index f2e56bef8..a90722a1d 100644
--- a/config/config_docker.json
+++ b/config/config_docker.json
@@ -58,7 +58,7 @@
"SMTPPassword": "",
"SMTPServer": "localhost:25",
"UseTLS": false,
- "FeedbackEmail": "feedback@xxxxxxmustbefilledin.com",
+ "FeedbackEmail": "",
"FeedbackName": "",
"ApplePushServer": "",
"ApplePushCertPublic": "",
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 {