diff options
author | Chris <ccbrown112@gmail.com> | 2018-01-22 15:32:50 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-22 15:32:50 -0600 |
commit | 599991ea731953f772824ce3ed1e591246aa004f (patch) | |
tree | fca0f556f12e56bdcefa74ac6794dec64e04e3fc /model/config.go | |
parent | a8445775351c32f8a12081f60bda2099571b2758 (diff) | |
download | chat-599991ea731953f772824ce3ed1e591246aa004f.tar.gz chat-599991ea731953f772824ce3ed1e591246aa004f.tar.bz2 chat-599991ea731953f772824ce3ed1e591246aa004f.zip |
PLT-3383: image proxy support (#7991)
* image proxy support
* go vet fix, remove mistakenly added coverage file
* fix test compile error
* add validation to config settings and documentation to model functions
* add message_source field to post
Diffstat (limited to 'model/config.go')
-rw-r--r-- | model/config.go | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/model/config.go b/model/config.go index d1bb0a41c..6e3e8859e 100644 --- a/model/config.go +++ b/model/config.go @@ -214,6 +214,9 @@ type ServiceSettings struct { EnablePreviewFeatures *bool EnableTutorial *bool ExperimentalEnableDefaultChannelLeaveJoinMessages *bool + ImageProxyType *string + ImageProxyURL *string + ImageProxyOptions *string } func (s *ServiceSettings) SetDefaults() { @@ -250,7 +253,7 @@ func (s *ServiceSettings) SetDefaults() { } if s.AllowedUntrustedInternalConnections == nil { - s.AllowedUntrustedInternalConnections = new(string) + s.AllowedUntrustedInternalConnections = NewString("") } if s.EnableMultifactorAuthentication == nil { @@ -418,6 +421,18 @@ func (s *ServiceSettings) SetDefaults() { if s.ExperimentalEnableDefaultChannelLeaveJoinMessages == nil { s.ExperimentalEnableDefaultChannelLeaveJoinMessages = NewBool(true) } + + if s.ImageProxyType == nil { + s.ImageProxyType = NewString("") + } + + if s.ImageProxyURL == nil { + s.ImageProxyURL = NewString("") + } + + if s.ImageProxyOptions == nil { + s.ImageProxyOptions = NewString("") + } } type ClusterSettings struct { @@ -2050,6 +2065,16 @@ func (ss *ServiceSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.listen_address.app_error", nil, "", http.StatusBadRequest) } + switch *ss.ImageProxyType { + case "", "willnorris/imageproxy": + case "atmos/camo": + if *ss.ImageProxyOptions == "" { + return NewAppError("Config.IsValid", "model.config.is_valid.atmos_camo_image_proxy_options.app_error", nil, "", http.StatusBadRequest) + } + default: + return NewAppError("Config.IsValid", "model.config.is_valid.image_proxy_type.app_error", nil, "", http.StatusBadRequest) + } + return nil } |