summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-05-30 06:58:24 -0700
committerJoram Wilander <jwawilander@gmail.com>2018-05-30 09:58:24 -0400
commitaf4e907f5e21d85622d4d7c08a7f29c3d4c46039 (patch)
treecdf2dd1c59d744b5c81d543c9e97cb74b2d3d28a /model/config.go
parent2f6039f23f75ef0d63f980c8354d3d638071f230 (diff)
downloadchat-af4e907f5e21d85622d4d7c08a7f29c3d4c46039.tar.gz
chat-af4e907f5e21d85622d4d7c08a7f29c3d4c46039.tar.bz2
chat-af4e907f5e21d85622d4d7c08a7f29c3d4c46039.zip
MM-10731 Revert site url kill server (#8877)
* Revert "MM-9983 Requiring SiteURL to be set. (#8769)" This reverts commit 0432f995ec27de9ee6cc2f5847d4a17fcc095a26. * Add log message for SiteURL not being set.
Diffstat (limited to 'model/config.go')
-rw-r--r--model/config.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go
index ba3a02d33..d5a8ad38e 100644
--- a/model/config.go
+++ b/model/config.go
@@ -1900,10 +1900,18 @@ func (o *Config) SetDefaults() {
}
func (o *Config) IsValid() *AppError {
+ if len(*o.ServiceSettings.SiteURL) == 0 && *o.EmailSettings.EnableEmailBatching {
+ return NewAppError("Config.IsValid", "model.config.is_valid.site_url_email_batching.app_error", nil, "", http.StatusBadRequest)
+ }
+
if *o.ClusterSettings.Enable && *o.EmailSettings.EnableEmailBatching {
return NewAppError("Config.IsValid", "model.config.is_valid.cluster_email_batching.app_error", nil, "", http.StatusBadRequest)
}
+ if len(*o.ServiceSettings.SiteURL) == 0 && *o.ServiceSettings.AllowCookiesForSubdomains {
+ return NewAppError("Config.IsValid", "Allowing cookies for subdomains requires SiteURL to be set.", nil, "", http.StatusBadRequest)
+ }
+
if err := o.TeamSettings.isValid(); err != nil {
return err
}
@@ -2209,6 +2217,12 @@ func (ss *ServiceSettings) isValid() *AppError {
return NewAppError("Config.IsValid", "model.config.is_valid.login_attempts.app_error", nil, "", http.StatusBadRequest)
}
+ if len(*ss.SiteURL) != 0 {
+ if _, err := url.ParseRequestURI(*ss.SiteURL); err != nil {
+ return NewAppError("Config.IsValid", "model.config.is_valid.site_url.app_error", nil, "", http.StatusBadRequest)
+ }
+ }
+
if len(*ss.WebsocketURL) != 0 {
if _, err := url.ParseRequestURI(*ss.WebsocketURL); err != nil {
return NewAppError("Config.IsValid", "model.config.is_valid.websocket_url.app_error", nil, "", http.StatusBadRequest)