diff options
author | Wim <wim@42.be> | 2016-09-17 15:19:18 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2016-09-17 15:19:18 +0200 |
commit | 16ed2aca6a3da13ad7eae394028a5918b1a6e49f (patch) | |
tree | 45977475fc9bdda5b464e728562743d485023cf4 /vendor/github.com/mattermost/platform/model/config.go | |
parent | 0f530e7902f71c8f66b6b697a7d004e9f45bd9da (diff) | |
download | matterbridge-msglm-16ed2aca6a3da13ad7eae394028a5918b1a6e49f.tar.gz matterbridge-msglm-16ed2aca6a3da13ad7eae394028a5918b1a6e49f.tar.bz2 matterbridge-msglm-16ed2aca6a3da13ad7eae394028a5918b1a6e49f.zip |
Sync with mattermost 3.4.0
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/config.go')
-rw-r--r-- | vendor/github.com/mattermost/platform/model/config.go | 73 |
1 files changed, 51 insertions, 22 deletions
diff --git a/vendor/github.com/mattermost/platform/model/config.go b/vendor/github.com/mattermost/platform/model/config.go index d13ba19e..3ad1c4c6 100644 --- a/vendor/github.com/mattermost/platform/model/config.go +++ b/vendor/github.com/mattermost/platform/model/config.go @@ -11,6 +11,7 @@ import ( const ( CONN_SECURITY_NONE = "" + CONN_SECURITY_PLAIN = "PLAIN" CONN_SECURITY_TLS = "TLS" CONN_SECURITY_STARTTLS = "STARTTLS" @@ -47,6 +48,9 @@ const ( RESTRICT_EMOJI_CREATION_ADMIN = "admin" RESTRICT_EMOJI_CREATION_SYSTEM_ADMIN = "system_admin" + EMAIL_BATCHING_BUFFER_SIZE = 256 + EMAIL_BATCHING_INTERVAL = 30 + SITENAME_MAX_LENGTH = 30 ) @@ -114,6 +118,7 @@ type LogSettings struct { FileFormat string FileLocation string EnableWebhookDebugging bool + EnableDiagnostics *bool } type PasswordSettings struct { @@ -129,7 +134,7 @@ type FileSettings struct { DriverName string Directory string EnablePublicLink bool - PublicLinkSalt string + PublicLinkSalt *string ThumbnailWidth int ThumbnailHeight int PreviewWidth int @@ -166,6 +171,9 @@ type EmailSettings struct { SendPushNotifications *bool PushNotificationServer *string PushNotificationContents *string + EnableEmailBatching *bool + EmailBatchingBufferSize *int + EmailBatchingInterval *int } type RateLimitSettings struct { @@ -350,8 +358,9 @@ func (o *Config) SetDefaults() { *o.FileSettings.MaxFileSize = 52428800 // 50 MB } - if len(o.FileSettings.PublicLinkSalt) == 0 { - o.FileSettings.PublicLinkSalt = NewRandomString(32) + if len(*o.FileSettings.PublicLinkSalt) == 0 { + o.FileSettings.PublicLinkSalt = new(string) + *o.FileSettings.PublicLinkSalt = NewRandomString(32) } if o.FileSettings.AmazonS3LocationConstraint == nil { @@ -507,6 +516,21 @@ func (o *Config) SetDefaults() { *o.EmailSettings.FeedbackOrganization = "" } + if o.EmailSettings.EnableEmailBatching == nil { + o.EmailSettings.EnableEmailBatching = new(bool) + *o.EmailSettings.EnableEmailBatching = false + } + + if o.EmailSettings.EmailBatchingBufferSize == nil { + o.EmailSettings.EmailBatchingBufferSize = new(int) + *o.EmailSettings.EmailBatchingBufferSize = EMAIL_BATCHING_BUFFER_SIZE + } + + if o.EmailSettings.EmailBatchingInterval == nil { + o.EmailSettings.EmailBatchingInterval = new(int) + *o.EmailSettings.EmailBatchingInterval = EMAIL_BATCHING_INTERVAL + } + if !IsSafeLink(o.SupportSettings.TermsOfServiceLink) { o.SupportSettings.TermsOfServiceLink = nil } @@ -758,6 +782,11 @@ func (o *Config) SetDefaults() { *o.LocalizationSettings.AvailableLocales = "" } + if o.LogSettings.EnableDiagnostics == nil { + o.LogSettings.EnableDiagnostics = new(bool) + *o.LogSettings.EnableDiagnostics = true + } + if o.SamlSettings.Enable == nil { o.SamlSettings.Enable = new(bool) *o.SamlSettings.Enable = false @@ -870,6 +899,14 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.listen_address.app_error", nil, "") } + if *o.ClusterSettings.Enable && *o.EmailSettings.EnableEmailBatching { + return NewLocAppError("Config.IsValid", "model.config.is_valid.cluster_email_batching.app_error", nil, "") + } + + if len(*o.ServiceSettings.SiteURL) == 0 && *o.EmailSettings.EnableEmailBatching { + return NewLocAppError("Config.IsValid", "model.config.is_valid.site_url_email_batching.app_error", nil, "") + } + if o.TeamSettings.MaxUsersPerTeam <= 0 { return NewLocAppError("Config.IsValid", "model.config.is_valid.max_users.app_error", nil, "") } @@ -930,11 +967,11 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.file_thumb_width.app_error", nil, "") } - if len(o.FileSettings.PublicLinkSalt) < 32 { + if len(*o.FileSettings.PublicLinkSalt) < 32 { return NewLocAppError("Config.IsValid", "model.config.is_valid.file_salt.app_error", nil, "") } - if !(o.EmailSettings.ConnectionSecurity == CONN_SECURITY_NONE || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_TLS || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_STARTTLS) { + if !(o.EmailSettings.ConnectionSecurity == CONN_SECURITY_NONE || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_TLS || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_STARTTLS || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_PLAIN) { return NewLocAppError("Config.IsValid", "model.config.is_valid.email_security.app_error", nil, "") } @@ -946,6 +983,14 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.email_reset_salt.app_error", nil, "") } + if *o.EmailSettings.EmailBatchingBufferSize <= 0 { + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_batching_buffer_size.app_error", nil, "") + } + + if *o.EmailSettings.EmailBatchingInterval < 30 { + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_batching_interval.app_error", nil, "") + } + if o.RateLimitSettings.MemoryStoreSize <= 0 { return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_mem.app_error", nil, "") } @@ -975,14 +1020,6 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_basedn", nil, "") } - if *o.LdapSettings.FirstNameAttribute == "" { - return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_firstname", nil, "") - } - - if *o.LdapSettings.LastNameAttribute == "" { - return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_lastname", nil, "") - } - if *o.LdapSettings.EmailAttribute == "" { return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_email", nil, "") } @@ -1017,14 +1054,6 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.saml_username_attribute.app_error", nil, "") } - if len(*o.SamlSettings.FirstNameAttribute) == 0 { - return NewLocAppError("Config.IsValid", "model.config.is_valid.saml_first_name_attribute.app_error", nil, "") - } - - if len(*o.SamlSettings.LastNameAttribute) == 0 { - return NewLocAppError("Config.IsValid", "model.config.is_valid.saml_last_name_attribute.app_error", nil, "") - } - if *o.SamlSettings.Verify { if len(*o.SamlSettings.AssertionConsumerServiceURL) == 0 || !IsValidHttpUrl(*o.SamlSettings.AssertionConsumerServiceURL) { return NewLocAppError("Config.IsValid", "model.config.is_valid.saml_assertion_consumer_service_url.app_error", nil, "") @@ -1070,7 +1099,7 @@ func (o *Config) Sanitize() { *o.LdapSettings.BindPassword = FAKE_SETTING } - o.FileSettings.PublicLinkSalt = FAKE_SETTING + *o.FileSettings.PublicLinkSalt = FAKE_SETTING if len(o.FileSettings.AmazonS3SecretAccessKey) > 0 { o.FileSettings.AmazonS3SecretAccessKey = FAKE_SETTING } |