summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-02-20 12:49:45 -0800
committerGitHub <noreply@github.com>2018-02-20 12:49:45 -0800
commit75d9a3a3b99d0acafb6783a721a35ab1ccdd8d9d (patch)
treee362a6a112af73c8b5d9c7739753751429903a26 /model/config.go
parentfebc129ecaa2a0ca8c6f8deeac654cb296b2b436 (diff)
downloadchat-75d9a3a3b99d0acafb6783a721a35ab1ccdd8d9d.tar.gz
chat-75d9a3a3b99d0acafb6783a721a35ab1ccdd8d9d.tar.bz2
chat-75d9a3a3b99d0acafb6783a721a35ab1ccdd8d9d.zip
MM-8681 Adding config settings necessary for using CloudFront. (#8307)
* Adding config settings nessisary for using CloudFront. * Adding new config settings to diagnostics.
Diffstat (limited to 'model/config.go')
-rw-r--r--model/config.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go
index 898099d12..1b916fe13 100644
--- a/model/config.go
+++ b/model/config.go
@@ -165,6 +165,7 @@ const (
type ServiceSettings struct {
SiteURL *string
+ WebsocketURL *string
LicenseFileLocation *string
ListenAddress *string
ConnectionSecurity *string
@@ -196,6 +197,7 @@ type ServiceSettings struct {
EnforceMultifactorAuthentication *bool
EnableUserAccessTokens *bool
AllowCorsFrom *string
+ AllowCookiesForSubdomains *bool
SessionLengthWebInDays *int
SessionLengthMobileInDays *int
SessionLengthSSOInDays *int
@@ -232,6 +234,10 @@ func (s *ServiceSettings) SetDefaults() {
s.SiteURL = NewString(SERVICE_SETTINGS_DEFAULT_SITE_URL)
}
+ if s.WebsocketURL == nil {
+ s.WebsocketURL = NewString("")
+ }
+
if s.LicenseFileLocation == nil {
s.LicenseFileLocation = NewString("")
}
@@ -388,6 +394,10 @@ func (s *ServiceSettings) SetDefaults() {
s.AllowCorsFrom = NewString(SERVICE_SETTINGS_DEFAULT_ALLOW_CORS_FROM)
}
+ if s.AllowCookiesForSubdomains == nil {
+ s.AllowCookiesForSubdomains = NewBool(false)
+ }
+
if s.WebserverMode == nil {
s.WebserverMode = NewString("gzip")
} else if *s.WebserverMode == "regular" {
@@ -1778,6 +1788,10 @@ func (o *Config) IsValid() *AppError {
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
}
@@ -2085,6 +2099,12 @@ func (ss *ServiceSettings) isValid() *AppError {
}
}
+ 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)
+ }
+ }
+
if len(*ss.ListenAddress) == 0 {
return NewAppError("Config.IsValid", "model.config.is_valid.listen_address.app_error", nil, "", http.StatusBadRequest)
}