diff options
author | Wim <wim@42.be> | 2021-10-17 00:47:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-17 00:47:22 +0200 |
commit | 4dd8bae5c91fa4aef09d865d8fef1acd84f90925 (patch) | |
tree | ffad9b242daccaf8c86d1c1fbd59032302bd3be9 /vendor/github.com/mattermost/mattermost-server/v5/model/config.go | |
parent | 7ae45c42e712bd0e66c101f3f714c05aa1dc2104 (diff) | |
download | matterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.tar.gz matterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.tar.bz2 matterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.zip |
Update dependencies (#1610)
* Update dependencies
* Update module to go 1.17
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/config.go')
-rw-r--r-- | vendor/github.com/mattermost/mattermost-server/v5/model/config.go | 1195 |
1 files changed, 725 insertions, 470 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/config.go b/vendor/github.com/mattermost/mattermost-server/v5/model/config.go index cbdf0f55..548a266e 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/config.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/config.go @@ -19,7 +19,9 @@ import ( "time" "github.com/mattermost/ldap" - "github.com/mattermost/mattermost-server/v5/mlog" + + "github.com/mattermost/mattermost-server/v5/shared/filestore" + "github.com/mattermost/mattermost-server/v5/shared/mlog" ) const ( @@ -31,10 +33,11 @@ const ( IMAGE_DRIVER_LOCAL = "local" IMAGE_DRIVER_S3 = "amazons3" - DATABASE_DRIVER_SQLITE = "sqlite3" DATABASE_DRIVER_MYSQL = "mysql" DATABASE_DRIVER_POSTGRES = "postgres" + SEARCHENGINE_ELASTICSEARCH = "elasticsearch" + MINIO_ACCESS_KEY = "minioaccesskey" MINIO_SECRET_KEY = "miniosecretkey" MINIO_BUCKET = "mattermost-test" @@ -45,11 +48,12 @@ const ( SERVICE_GITLAB = "gitlab" SERVICE_GOOGLE = "google" SERVICE_OFFICE365 = "office365" + SERVICE_OPENID = "openid" GENERIC_NO_CHANNEL_NOTIFICATION = "generic_no_channel" GENERIC_NOTIFICATION = "generic" GENERIC_NOTIFICATION_SERVER = "https://push-test.mattermost.com" - MM_SUPPORT_ADDRESS = "support@mattermost.com" + MM_SUPPORT_ADVISOR_ADDRESS = "support-advisor@mattermost.com" FULL_NOTIFICATION = "full" ID_LOADED_NOTIFICATION = "id_loaded" @@ -83,6 +87,10 @@ const ( GROUP_UNREAD_CHANNELS_DEFAULT_ON = "default_on" GROUP_UNREAD_CHANNELS_DEFAULT_OFF = "default_off" + COLLAPSED_THREADS_DISABLED = "disabled" + COLLAPSED_THREADS_DEFAULT_ON = "default_on" + COLLAPSED_THREADS_DEFAULT_OFF = "default_off" + EMAIL_BATCHING_BUFFER_SIZE = 256 EMAIL_BATCHING_INTERVAL = 30 @@ -113,14 +121,20 @@ const ( FILE_SETTINGS_DEFAULT_DIRECTORY = "./data/" + IMPORT_SETTINGS_DEFAULT_DIRECTORY = "./import" + IMPORT_SETTINGS_DEFAULT_RETENTION_DAYS = 30 + + EXPORT_SETTINGS_DEFAULT_DIRECTORY = "./export" + EXPORT_SETTINGS_DEFAULT_RETENTION_DAYS = 30 + EMAIL_SETTINGS_DEFAULT_FEEDBACK_ORGANIZATION = "" - SUPPORT_SETTINGS_DEFAULT_TERMS_OF_SERVICE_LINK = "https://about.mattermost.com/default-terms/" - SUPPORT_SETTINGS_DEFAULT_PRIVACY_POLICY_LINK = "https://about.mattermost.com/default-privacy-policy/" + SUPPORT_SETTINGS_DEFAULT_TERMS_OF_SERVICE_LINK = "https://mattermost.com/terms-of-service/" + SUPPORT_SETTINGS_DEFAULT_PRIVACY_POLICY_LINK = "https://mattermost.com/privacy-policy/" SUPPORT_SETTINGS_DEFAULT_ABOUT_LINK = "https://about.mattermost.com/default-about/" SUPPORT_SETTINGS_DEFAULT_HELP_LINK = "https://about.mattermost.com/default-help/" SUPPORT_SETTINGS_DEFAULT_REPORT_A_PROBLEM_LINK = "https://about.mattermost.com/default-report-a-problem/" - SUPPORT_SETTINGS_DEFAULT_SUPPORT_EMAIL = "feedback@mattermost.com" + SUPPORT_SETTINGS_DEFAULT_SUPPORT_EMAIL = "" SUPPORT_SETTINGS_DEFAULT_RE_ACCEPTANCE_PERIOD = 365 LDAP_SETTINGS_DEFAULT_FIRST_NAME_ATTRIBUTE = "" @@ -192,6 +206,7 @@ const ( DATA_RETENTION_SETTINGS_DEFAULT_MESSAGE_RETENTION_DAYS = 365 DATA_RETENTION_SETTINGS_DEFAULT_FILE_RETENTION_DAYS = 365 DATA_RETENTION_SETTINGS_DEFAULT_DELETION_JOB_START_TIME = "02:00" + DATA_RETENTION_SETTINGS_DEFAULT_BATCH_SIZE = 3000 PLUGIN_SETTINGS_DEFAULT_DIRECTORY = "./plugins" PLUGIN_SETTINGS_DEFAULT_CLIENT_DIRECTORY = "./client/plugins" @@ -222,11 +237,17 @@ const ( OFFICE365_SETTINGS_DEFAULT_TOKEN_ENDPOINT = "https://login.microsoftonline.com/common/oauth2/v2.0/token" OFFICE365_SETTINGS_DEFAULT_USER_API_ENDPOINT = "https://graph.microsoft.com/v1.0/me" - CLOUD_SETTINGS_DEFAULT_CWS_URL = "https://customers.mattermost.com" + CLOUD_SETTINGS_DEFAULT_CWS_URL = "https://customers.mattermost.com" + CLOUD_SETTINGS_DEFAULT_CWS_API_URL = "https://portal.internal.prod.cloud.mattermost.com" + OPENID_SETTINGS_DEFAULT_SCOPE = "profile openid email" LOCAL_MODE_SOCKET_PATH = "/var/tmp/mattermost_local.socket" ) +func GetDefaultAppCustomURLSchemes() []string { + return []string{"mmauth://", "mmauthbeta://"} +} + var ServerTLSSupportedCiphers = map[string]uint16{ "TLS_RSA_WITH_RC4_128_SHA": tls.TLS_RSA_WITH_RC4_128_SHA, "TLS_RSA_WITH_3DES_EDE_CBC_SHA": tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, @@ -253,105 +274,108 @@ var ServerTLSSupportedCiphers = map[string]uint16{ } type ServiceSettings struct { - SiteURL *string `access:"environment,authentication,write_restrictable"` + SiteURL *string `access:"environment_web_server,authentication_saml,write_restrictable"` WebsocketURL *string `access:"write_restrictable,cloud_restrictable"` - LicenseFileLocation *string `access:"write_restrictable,cloud_restrictable"` - ListenAddress *string `access:"environment,write_restrictable,cloud_restrictable"` - ConnectionSecurity *string `access:"environment,write_restrictable,cloud_restrictable"` - TLSCertFile *string `access:"environment,write_restrictable,cloud_restrictable"` - TLSKeyFile *string `access:"environment,write_restrictable,cloud_restrictable"` - TLSMinVer *string `access:"write_restrictable,cloud_restrictable"` + LicenseFileLocation *string `access:"write_restrictable,cloud_restrictable"` // telemetry: none + ListenAddress *string `access:"environment_web_server,write_restrictable,cloud_restrictable"` // telemetry: none + ConnectionSecurity *string `access:"environment_web_server,write_restrictable,cloud_restrictable"` + TLSCertFile *string `access:"environment_web_server,write_restrictable,cloud_restrictable"` + TLSKeyFile *string `access:"environment_web_server,write_restrictable,cloud_restrictable"` + TLSMinVer *string `access:"write_restrictable,cloud_restrictable"` // telemetry: none TLSStrictTransport *bool `access:"write_restrictable,cloud_restrictable"` - TLSStrictTransportMaxAge *int64 `access:"write_restrictable,cloud_restrictable"` - TLSOverwriteCiphers []string `access:"write_restrictable,cloud_restrictable"` - UseLetsEncrypt *bool `access:"environment,write_restrictable,cloud_restrictable"` - LetsEncryptCertificateCacheFile *string `access:"environment,write_restrictable,cloud_restrictable"` - Forward80To443 *bool `access:"environment,write_restrictable,cloud_restrictable"` - TrustedProxyIPHeader []string `access:"write_restrictable,cloud_restrictable"` - ReadTimeout *int `access:"environment,write_restrictable,cloud_restrictable"` - WriteTimeout *int `access:"environment,write_restrictable,cloud_restrictable"` + TLSStrictTransportMaxAge *int64 `access:"write_restrictable,cloud_restrictable"` // telemetry: none + TLSOverwriteCiphers []string `access:"write_restrictable,cloud_restrictable"` // telemetry: none + UseLetsEncrypt *bool `access:"environment_web_server,write_restrictable,cloud_restrictable"` + LetsEncryptCertificateCacheFile *string `access:"environment_web_server,write_restrictable,cloud_restrictable"` // telemetry: none + Forward80To443 *bool `access:"environment_web_server,write_restrictable,cloud_restrictable"` + TrustedProxyIPHeader []string `access:"write_restrictable,cloud_restrictable"` // telemetry: none + ReadTimeout *int `access:"environment_web_server,write_restrictable,cloud_restrictable"` + WriteTimeout *int `access:"environment_web_server,write_restrictable,cloud_restrictable"` IdleTimeout *int `access:"write_restrictable,cloud_restrictable"` - MaximumLoginAttempts *int `access:"authentication,write_restrictable,cloud_restrictable"` - GoroutineHealthThreshold *int `access:"write_restrictable,cloud_restrictable"` - GoogleDeveloperKey *string `access:"site,write_restrictable,cloud_restrictable"` - EnableOAuthServiceProvider *bool `access:"integrations"` - EnableIncomingWebhooks *bool `access:"integrations"` - EnableOutgoingWebhooks *bool `access:"integrations"` - EnableCommands *bool `access:"integrations"` - DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations *bool `json:"EnableOnlyAdminIntegrations" mapstructure:"EnableOnlyAdminIntegrations"` // This field is deprecated and must not be used. - EnablePostUsernameOverride *bool `access:"integrations"` - EnablePostIconOverride *bool `access:"integrations"` - EnableLinkPreviews *bool `access:"site"` - EnableTesting *bool `access:"environment,write_restrictable,cloud_restrictable"` - EnableDeveloper *bool `access:"environment,write_restrictable,cloud_restrictable"` + MaximumLoginAttempts *int `access:"authentication_password,write_restrictable,cloud_restrictable"` + GoroutineHealthThreshold *int `access:"write_restrictable,cloud_restrictable"` // telemetry: none + EnableOAuthServiceProvider *bool `access:"integrations_integration_management"` + EnableIncomingWebhooks *bool `access:"integrations_integration_management"` + EnableOutgoingWebhooks *bool `access:"integrations_integration_management"` + EnableCommands *bool `access:"integrations_integration_management"` + EnablePostUsernameOverride *bool `access:"integrations_integration_management"` + EnablePostIconOverride *bool `access:"integrations_integration_management"` + GoogleDeveloperKey *string `access:"site_posts,write_restrictable,cloud_restrictable"` + DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations *bool `json:"EnableOnlyAdminIntegrations" mapstructure:"EnableOnlyAdminIntegrations"` // Deprecated: do not use + EnableLinkPreviews *bool `access:"site_posts"` + RestrictLinkPreviews *string `access:"site_posts"` + EnableTesting *bool `access:"environment_developer,write_restrictable,cloud_restrictable"` + EnableDeveloper *bool `access:"environment_developer,write_restrictable,cloud_restrictable"` EnableOpenTracing *bool `access:"write_restrictable,cloud_restrictable"` - EnableSecurityFixAlert *bool `access:"environment,write_restrictable,cloud_restrictable"` - EnableInsecureOutgoingConnections *bool `access:"environment,write_restrictable,cloud_restrictable"` - AllowedUntrustedInternalConnections *string `access:"environment,write_restrictable,cloud_restrictable"` - EnableMultifactorAuthentication *bool `access:"authentication"` - EnforceMultifactorAuthentication *bool `access:"authentication"` - EnableUserAccessTokens *bool `access:"integrations"` - AllowCorsFrom *string `access:"integrations,write_restrictable,cloud_restrictable"` - CorsExposedHeaders *string `access:"integrations,write_restrictable,cloud_restrictable"` - CorsAllowCredentials *bool `access:"integrations,write_restrictable,cloud_restrictable"` - CorsDebug *bool `access:"integrations,write_restrictable,cloud_restrictable"` + EnableSecurityFixAlert *bool `access:"environment_smtp,write_restrictable,cloud_restrictable"` + EnableInsecureOutgoingConnections *bool `access:"environment_web_server,write_restrictable,cloud_restrictable"` + AllowedUntrustedInternalConnections *string `access:"environment_web_server,write_restrictable,cloud_restrictable"` + EnableMultifactorAuthentication *bool `access:"authentication_mfa"` + EnforceMultifactorAuthentication *bool `access:"authentication_mfa"` + EnableUserAccessTokens *bool `access:"integrations_integration_management"` + AllowCorsFrom *string `access:"integrations_cors,write_restrictable,cloud_restrictable"` + CorsExposedHeaders *string `access:"integrations_cors,write_restrictable,cloud_restrictable"` + CorsAllowCredentials *bool `access:"integrations_cors,write_restrictable,cloud_restrictable"` + CorsDebug *bool `access:"integrations_cors,write_restrictable,cloud_restrictable"` AllowCookiesForSubdomains *bool `access:"write_restrictable,cloud_restrictable"` - ExtendSessionLengthWithActivity *bool `access:"environment,write_restrictable,cloud_restrictable"` - SessionLengthWebInDays *int `access:"environment,write_restrictable,cloud_restrictable"` - SessionLengthMobileInDays *int `access:"environment,write_restrictable,cloud_restrictable"` - SessionLengthSSOInDays *int `access:"environment,write_restrictable,cloud_restrictable"` - SessionCacheInMinutes *int `access:"environment,write_restrictable,cloud_restrictable"` - SessionIdleTimeoutInMinutes *int `access:"environment,write_restrictable,cloud_restrictable"` - WebsocketSecurePort *int `access:"write_restrictable,cloud_restrictable"` - WebsocketPort *int `access:"write_restrictable,cloud_restrictable"` - WebserverMode *string `access:"environment,write_restrictable,cloud_restrictable"` - EnableCustomEmoji *bool `access:"site"` - EnableEmojiPicker *bool `access:"site"` - EnableGifPicker *bool `access:"integrations"` - GfycatApiKey *string `access:"integrations"` - GfycatApiSecret *string `access:"integrations"` - DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation *string `json:"RestrictCustomEmojiCreation" mapstructure:"RestrictCustomEmojiCreation"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_RestrictPostDelete *string `json:"RestrictPostDelete" mapstructure:"RestrictPostDelete"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_AllowEditPost *string `json:"AllowEditPost" mapstructure:"AllowEditPost"` // This field is deprecated and must not be used. + ExtendSessionLengthWithActivity *bool `access:"environment_session_lengths,write_restrictable,cloud_restrictable"` + SessionLengthWebInDays *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"` + SessionLengthMobileInDays *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"` + SessionLengthSSOInDays *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"` + SessionCacheInMinutes *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"` + SessionIdleTimeoutInMinutes *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"` + WebsocketSecurePort *int `access:"write_restrictable,cloud_restrictable"` // telemetry: none + WebsocketPort *int `access:"write_restrictable,cloud_restrictable"` // telemetry: none + WebserverMode *string `access:"environment_web_server,write_restrictable,cloud_restrictable"` + EnableGifPicker *bool `access:"integrations_gif"` + GfycatApiKey *string `access:"integrations_gif"` + GfycatApiSecret *string `access:"integrations_gif"` + EnableCustomEmoji *bool `access:"site_emoji"` + EnableEmojiPicker *bool `access:"site_emoji"` + DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation *string `json:"RestrictCustomEmojiCreation" mapstructure:"RestrictCustomEmojiCreation"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_RestrictPostDelete *string `json:"RestrictPostDelete" mapstructure:"RestrictPostDelete"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_AllowEditPost *string `json:"AllowEditPost" mapstructure:"AllowEditPost"` // Deprecated: do not use PostEditTimeLimit *int `access:"user_management_permissions"` - TimeBetweenUserTypingUpdatesMilliseconds *int64 `access:"experimental,write_restrictable,cloud_restrictable"` + TimeBetweenUserTypingUpdatesMilliseconds *int64 `access:"experimental_features,write_restrictable,cloud_restrictable"` EnablePostSearch *bool `access:"write_restrictable,cloud_restrictable"` - MinimumHashtagLength *int `access:"environment,write_restrictable,cloud_restrictable"` - EnableUserTypingMessages *bool `access:"experimental,write_restrictable,cloud_restrictable"` - EnableChannelViewedMessages *bool `access:"experimental,write_restrictable,cloud_restrictable"` + EnableFileSearch *bool `access:"write_restrictable"` + MinimumHashtagLength *int `access:"environment_database,write_restrictable,cloud_restrictable"` + EnableUserTypingMessages *bool `access:"experimental_features,write_restrictable,cloud_restrictable"` + EnableChannelViewedMessages *bool `access:"experimental_features,write_restrictable,cloud_restrictable"` EnableUserStatuses *bool `access:"write_restrictable,cloud_restrictable"` - ExperimentalEnableAuthenticationTransfer *bool `access:"experimental,write_restrictable,cloud_restrictable"` + ExperimentalEnableAuthenticationTransfer *bool `access:"experimental_features,write_restrictable,cloud_restrictable"` ClusterLogTimeoutMilliseconds *int `access:"write_restrictable,cloud_restrictable"` - CloseUnusedDirectMessages *bool `access:"experimental"` - EnablePreviewFeatures *bool `access:"experimental"` - EnableTutorial *bool `access:"experimental"` - ExperimentalEnableDefaultChannelLeaveJoinMessages *bool `access:"experimental"` - ExperimentalGroupUnreadChannels *string `access:"experimental"` - ExperimentalChannelOrganization *bool `access:"experimental"` - ExperimentalChannelSidebarOrganization *string `access:"experimental"` - ExperimentalDataPrefetch *bool `access:"experimental"` - DEPRECATED_DO_NOT_USE_ImageProxyType *string `json:"ImageProxyType" mapstructure:"ImageProxyType"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_ImageProxyURL *string `json:"ImageProxyURL" mapstructure:"ImageProxyURL"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_ImageProxyOptions *string `json:"ImageProxyOptions" mapstructure:"ImageProxyOptions"` // This field is deprecated and must not be used. + CloseUnusedDirectMessages *bool `access:"experimental_features"` + EnablePreviewFeatures *bool `access:"experimental_features"` + EnableTutorial *bool `access:"experimental_features"` + ExperimentalEnableDefaultChannelLeaveJoinMessages *bool `access:"experimental_features"` + ExperimentalGroupUnreadChannels *string `access:"experimental_features"` + ExperimentalChannelOrganization *bool `access:"experimental_features"` + DEPRECATED_DO_NOT_USE_ImageProxyType *string `json:"ImageProxyType" mapstructure:"ImageProxyType"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_ImageProxyURL *string `json:"ImageProxyURL" mapstructure:"ImageProxyURL"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_ImageProxyOptions *string `json:"ImageProxyOptions" mapstructure:"ImageProxyOptions"` // Deprecated: do not use EnableAPITeamDeletion *bool EnableAPIUserDeletion *bool - ExperimentalEnableHardenedMode *bool `access:"experimental"` + ExperimentalEnableHardenedMode *bool `access:"experimental_features"` DisableLegacyMFA *bool `access:"write_restrictable,cloud_restrictable"` - ExperimentalStrictCSRFEnforcement *bool `access:"experimental,write_restrictable,cloud_restrictable"` - EnableEmailInvitations *bool `access:"authentication"` - DisableBotsWhenOwnerIsDeactivated *bool `access:"integrations,write_restrictable,cloud_restrictable"` - EnableBotAccountCreation *bool `access:"integrations"` - EnableSVGs *bool `access:"site"` - EnableLatex *bool `access:"site"` + ExperimentalStrictCSRFEnforcement *bool `access:"experimental_features,write_restrictable,cloud_restrictable"` + EnableEmailInvitations *bool `access:"authentication_signup"` + DisableBotsWhenOwnerIsDeactivated *bool `access:"integrations_bot_accounts,write_restrictable,cloud_restrictable"` + EnableBotAccountCreation *bool `access:"integrations_bot_accounts"` + EnableSVGs *bool `access:"site_posts"` + EnableLatex *bool `access:"site_posts"` EnableAPIChannelDeletion *bool EnableLocalMode *bool - LocalModeSocketLocation *string - EnableAWSMetering *bool - SplitKey *string `access:"environment,write_restrictable"` - FeatureFlagSyncIntervalSeconds *int `access:"environment,write_restrictable"` - DebugSplit *bool `access:"environment,write_restrictable"` - ThreadAutoFollow *bool `access:"experimental"` - ManagedResourcePaths *string `access:"environment,write_restrictable,cloud_restrictable"` + LocalModeSocketLocation *string // telemetry: none + EnableAWSMetering *bool // telemetry: none + SplitKey *string `access:"experimental_feature_flags,write_restrictable"` // telemetry: none + FeatureFlagSyncIntervalSeconds *int `access:"experimental_feature_flags,write_restrictable"` // telemetry: none + DebugSplit *bool `access:"experimental_feature_flags,write_restrictable"` // telemetry: none + ThreadAutoFollow *bool `access:"experimental_features"` + CollapsedThreads *string `access:"experimental_features"` + ManagedResourcePaths *string `access:"environment_web_server,write_restrictable,cloud_restrictable"` + EnableLegacySidebar *bool `access:"experimental_features"` + EnableReliableWebSockets *bool `access:"experimental_features"` // telemetry: none } func (s *ServiceSettings) SetDefaults(isUpdate bool) { @@ -388,6 +412,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { s.EnableLinkPreviews = NewBool(true) } + if s.RestrictLinkPreviews == nil { + s.RestrictLinkPreviews = NewString("") + } + if s.EnableTesting == nil { s.EnableTesting = NewBool(false) } @@ -518,6 +546,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { s.EnablePostSearch = NewBool(true) } + if s.EnableFileSearch == nil { + s.EnableFileSearch = NewBool(true) + } + if s.MinimumHashtagLength == nil { s.MinimumHashtagLength = NewInt(3) } @@ -690,14 +722,6 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { s.ExperimentalChannelOrganization = NewBool(experimentalUnreadEnabled) } - if s.ExperimentalChannelSidebarOrganization == nil { - s.ExperimentalChannelSidebarOrganization = NewString("disabled") - } - - if s.ExperimentalDataPrefetch == nil { - s.ExperimentalDataPrefetch = NewBool(true) - } - if s.DEPRECATED_DO_NOT_USE_ImageProxyType == nil { s.DEPRECATED_DO_NOT_USE_ImageProxyType = NewString("") } @@ -786,27 +810,40 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { s.ThreadAutoFollow = NewBool(true) } + if s.CollapsedThreads == nil { + s.CollapsedThreads = NewString(COLLAPSED_THREADS_DISABLED) + } + if s.ManagedResourcePaths == nil { s.ManagedResourcePaths = NewString("") } + + if s.EnableLegacySidebar == nil { + s.EnableLegacySidebar = NewBool(false) + } + + if s.EnableReliableWebSockets == nil { + s.EnableReliableWebSockets = NewBool(true) + } } type ClusterSettings struct { - Enable *bool `access:"environment,write_restrictable"` - ClusterName *string `access:"environment,write_restrictable,cloud_restrictable"` - OverrideHostname *string `access:"environment,write_restrictable,cloud_restrictable"` - NetworkInterface *string `access:"environment,write_restrictable,cloud_restrictable"` - BindAddress *string `access:"environment,write_restrictable,cloud_restrictable"` - AdvertiseAddress *string `access:"environment,write_restrictable,cloud_restrictable"` - UseIpAddress *bool `access:"environment,write_restrictable,cloud_restrictable"` - UseExperimentalGossip *bool `access:"environment,write_restrictable,cloud_restrictable"` - EnableExperimentalGossipEncryption *bool `access:"environment,write_restrictable,cloud_restrictable"` - ReadOnlyConfig *bool `access:"environment,write_restrictable,cloud_restrictable"` - GossipPort *int `access:"environment,write_restrictable,cloud_restrictable"` - StreamingPort *int `access:"environment,write_restrictable,cloud_restrictable"` - MaxIdleConns *int `access:"environment,write_restrictable,cloud_restrictable"` - MaxIdleConnsPerHost *int `access:"environment,write_restrictable,cloud_restrictable"` - IdleConnTimeoutMilliseconds *int `access:"environment,write_restrictable,cloud_restrictable"` + Enable *bool `access:"environment_high_availability,write_restrictable"` + ClusterName *string `access:"environment_high_availability,write_restrictable,cloud_restrictable"` // telemetry: none + OverrideHostname *string `access:"environment_high_availability,write_restrictable,cloud_restrictable"` // telemetry: none + NetworkInterface *string `access:"environment_high_availability,write_restrictable,cloud_restrictable"` + BindAddress *string `access:"environment_high_availability,write_restrictable,cloud_restrictable"` + AdvertiseAddress *string `access:"environment_high_availability,write_restrictable,cloud_restrictable"` + UseIpAddress *bool `access:"environment_high_availability,write_restrictable,cloud_restrictable"` + DEPRECATED_DO_NOT_USE_UseExperimentalGossip *bool `json:"UseExperimentalGossip" access:"environment_high_availability,write_restrictable,cloud_restrictable"` // Deprecated: do not use + EnableGossipCompression *bool `access:"environment_high_availability,write_restrictable,cloud_restrictable"` + EnableExperimentalGossipEncryption *bool `access:"environment_high_availability,write_restrictable,cloud_restrictable"` + ReadOnlyConfig *bool `access:"environment_high_availability,write_restrictable,cloud_restrictable"` + GossipPort *int `access:"environment_high_availability,write_restrictable,cloud_restrictable"` // telemetry: none + StreamingPort *int `access:"environment_high_availability,write_restrictable,cloud_restrictable"` // telemetry: none + MaxIdleConns *int `access:"environment_high_availability,write_restrictable,cloud_restrictable"` // telemetry: none + MaxIdleConnsPerHost *int `access:"environment_high_availability,write_restrictable,cloud_restrictable"` // telemetry: none + IdleConnTimeoutMilliseconds *int `access:"environment_high_availability,write_restrictable,cloud_restrictable"` // telemetry: none } func (s *ClusterSettings) SetDefaults() { @@ -838,14 +875,18 @@ func (s *ClusterSettings) SetDefaults() { s.UseIpAddress = NewBool(true) } - if s.UseExperimentalGossip == nil { - s.UseExperimentalGossip = NewBool(false) + if s.DEPRECATED_DO_NOT_USE_UseExperimentalGossip == nil { + s.DEPRECATED_DO_NOT_USE_UseExperimentalGossip = NewBool(true) } if s.EnableExperimentalGossipEncryption == nil { s.EnableExperimentalGossipEncryption = NewBool(false) } + if s.EnableGossipCompression == nil { + s.EnableGossipCompression = NewBool(true) + } + if s.ReadOnlyConfig == nil { s.ReadOnlyConfig = NewBool(true) } @@ -872,9 +913,9 @@ func (s *ClusterSettings) SetDefaults() { } type MetricsSettings struct { - Enable *bool `access:"environment,write_restrictable,cloud_restrictable"` - BlockProfileRate *int `access:"environment,write_restrictable,cloud_restrictable"` - ListenAddress *string `access:"environment,write_restrictable,cloud_restrictable"` + Enable *bool `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"` + BlockProfileRate *int `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"` + ListenAddress *string `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"` // telemetry: none } func (s *MetricsSettings) SetDefaults() { @@ -892,15 +933,16 @@ func (s *MetricsSettings) SetDefaults() { } type ExperimentalSettings struct { - ClientSideCertEnable *bool `access:"experimental,cloud_restrictable"` - ClientSideCertCheck *string `access:"experimental,cloud_restrictable"` - EnableClickToReply *bool `access:"experimental,write_restrictable,cloud_restrictable"` - LinkMetadataTimeoutMilliseconds *int64 `access:"experimental,write_restrictable,cloud_restrictable"` - RestrictSystemAdmin *bool `access:"experimental,write_restrictable"` - UseNewSAMLLibrary *bool `access:"experimental,cloud_restrictable"` - CloudUserLimit *int64 `access:"experimental,write_restrictable"` - CloudBilling *bool `access:"experimental,write_restrictable"` - EnableSharedChannels *bool `access:"experimental"` + ClientSideCertEnable *bool `access:"experimental_features,cloud_restrictable"` + ClientSideCertCheck *string `access:"experimental_features,cloud_restrictable"` + EnableClickToReply *bool `access:"experimental_features,write_restrictable,cloud_restrictable"` + LinkMetadataTimeoutMilliseconds *int64 `access:"experimental_features,write_restrictable,cloud_restrictable"` + RestrictSystemAdmin *bool `access:"experimental_features,write_restrictable"` + UseNewSAMLLibrary *bool `access:"experimental_features,cloud_restrictable"` + CloudUserLimit *int64 `access:"experimental_features,write_restrictable"` + CloudBilling *bool `access:"experimental_features,write_restrictable"` + EnableSharedChannels *bool `access:"experimental_features"` + EnableRemoteClusterService *bool `access:"experimental_features"` } func (s *ExperimentalSettings) SetDefaults() { @@ -940,6 +982,10 @@ func (s *ExperimentalSettings) SetDefaults() { if s.EnableSharedChannels == nil { s.EnableSharedChannels = NewBool(false) } + + if s.EnableRemoteClusterService == nil { + s.EnableRemoteClusterService = NewBool(false) + } } type AnalyticsSettings struct { @@ -953,16 +999,19 @@ func (s *AnalyticsSettings) SetDefaults() { } type SSOSettings struct { - Enable *bool `access:"authentication"` - Secret *string `access:"authentication"` - Id *string `access:"authentication"` - Scope *string `access:"authentication"` - AuthEndpoint *string `access:"authentication"` - TokenEndpoint *string `access:"authentication"` - UserApiEndpoint *string `access:"authentication"` -} - -func (s *SSOSettings) setDefaults(scope, authEndpoint, tokenEndpoint, userApiEndpoint string) { + Enable *bool `access:"authentication_openid"` + Secret *string `access:"authentication_openid"` // telemetry: none + Id *string `access:"authentication_openid"` // telemetry: none + Scope *string `access:"authentication_openid"` // telemetry: none + AuthEndpoint *string `access:"authentication_openid"` // telemetry: none + TokenEndpoint *string `access:"authentication_openid"` // telemetry: none + UserApiEndpoint *string `access:"authentication_openid"` // telemetry: none + DiscoveryEndpoint *string `access:"authentication_openid"` // telemetry: none + ButtonText *string `access:"authentication_openid"` // telemetry: none + ButtonColor *string `access:"authentication_openid"` // telemetry: none +} + +func (s *SSOSettings) setDefaults(scope, authEndpoint, tokenEndpoint, userApiEndpoint, buttonColor string) { if s.Enable == nil { s.Enable = NewBool(false) } @@ -979,6 +1028,10 @@ func (s *SSOSettings) setDefaults(scope, authEndpoint, tokenEndpoint, userApiEnd s.Scope = NewString(scope) } + if s.DiscoveryEndpoint == nil { + s.DiscoveryEndpoint = NewString("") + } + if s.AuthEndpoint == nil { s.AuthEndpoint = NewString(authEndpoint) } @@ -990,17 +1043,26 @@ func (s *SSOSettings) setDefaults(scope, authEndpoint, tokenEndpoint, userApiEnd if s.UserApiEndpoint == nil { s.UserApiEndpoint = NewString(userApiEndpoint) } + + if s.ButtonText == nil { + s.ButtonText = NewString("") + } + + if s.ButtonColor == nil { + s.ButtonColor = NewString(buttonColor) + } } type Office365Settings struct { - Enable *bool `access:"authentication"` - Secret *string `access:"authentication"` - Id *string `access:"authentication"` - Scope *string `access:"authentication"` - AuthEndpoint *string `access:"authentication"` - TokenEndpoint *string `access:"authentication"` - UserApiEndpoint *string `access:"authentication"` - DirectoryId *string `access:"authentication"` + Enable *bool `access:"authentication_openid"` + Secret *string `access:"authentication_openid"` // telemetry: none + Id *string `access:"authentication_openid"` // telemetry: none + Scope *string `access:"authentication_openid"` + AuthEndpoint *string `access:"authentication_openid"` // telemetry: none + TokenEndpoint *string `access:"authentication_openid"` // telemetry: none + UserApiEndpoint *string `access:"authentication_openid"` // telemetry: none + DiscoveryEndpoint *string `access:"authentication_openid"` // telemetry: none + DirectoryId *string `access:"authentication_openid"` // telemetry: none } func (s *Office365Settings) setDefaults() { @@ -1020,6 +1082,10 @@ func (s *Office365Settings) setDefaults() { s.Scope = NewString(OFFICE365_SETTINGS_DEFAULT_SCOPE) } + if s.DiscoveryEndpoint == nil { + s.DiscoveryEndpoint = NewString("") + } + if s.AuthEndpoint == nil { s.AuthEndpoint = NewString(OFFICE365_SETTINGS_DEFAULT_AUTH_ENDPOINT) } @@ -1043,24 +1109,33 @@ func (s *Office365Settings) SSOSettings() *SSOSettings { ssoSettings.Secret = s.Secret ssoSettings.Id = s.Id ssoSettings.Scope = s.Scope + ssoSettings.DiscoveryEndpoint = s.DiscoveryEndpoint ssoSettings.AuthEndpoint = s.AuthEndpoint ssoSettings.TokenEndpoint = s.TokenEndpoint ssoSettings.UserApiEndpoint = s.UserApiEndpoint return &ssoSettings } +type ReplicaLagSettings struct { + DataSource *string `access:"environment,write_restrictable,cloud_restrictable"` // telemetry: none + QueryAbsoluteLag *string `access:"environment,write_restrictable,cloud_restrictable"` // telemetry: none + QueryTimeLag *string `access:"environment,write_restrictable,cloud_restrictable"` // telemetry: none +} + type SqlSettings struct { - DriverName *string `access:"environment,write_restrictable,cloud_restrictable"` - DataSource *string `access:"environment,write_restrictable,cloud_restrictable"` - DataSourceReplicas []string `access:"environment,write_restrictable,cloud_restrictable"` - DataSourceSearchReplicas []string `access:"environment,write_restrictable,cloud_restrictable"` - MaxIdleConns *int `access:"environment,write_restrictable,cloud_restrictable"` - ConnMaxLifetimeMilliseconds *int `access:"environment,write_restrictable,cloud_restrictable"` - MaxOpenConns *int `access:"environment,write_restrictable,cloud_restrictable"` - Trace *bool `access:"environment,write_restrictable,cloud_restrictable"` - AtRestEncryptKey *string `access:"environment,write_restrictable,cloud_restrictable"` - QueryTimeout *int `access:"environment,write_restrictable,cloud_restrictable"` - DisableDatabaseSearch *bool `access:"environment,write_restrictable,cloud_restrictable"` + DriverName *string `access:"environment_database,write_restrictable,cloud_restrictable"` + DataSource *string `access:"environment_database,write_restrictable,cloud_restrictable"` // telemetry: none + DataSourceReplicas []string `access:"environment_database,write_restrictable,cloud_restrictable"` + DataSourceSearchReplicas []string `access:"environment_database,write_restrictable,cloud_restrictable"` + MaxIdleConns *int `access:"environment_database,write_restrictable,cloud_restrictable"` + ConnMaxLifetimeMilliseconds *int `access:"environment_database,write_restrictable,cloud_restrictable"` + ConnMaxIdleTimeMilliseconds *int `access:"environment_database,write_restrictable,cloud_restrictable"` + MaxOpenConns *int `access:"environment_database,write_restrictable,cloud_restrictable"` + Trace *bool `access:"environment_database,write_restrictable,cloud_restrictable"` + AtRestEncryptKey *string `access:"environment_database,write_restrictable,cloud_restrictable"` // telemetry: none + QueryTimeout *int `access:"environment_database,write_restrictable,cloud_restrictable"` + DisableDatabaseSearch *bool `access:"environment_database,write_restrictable,cloud_restrictable"` + ReplicaLagSettings []*ReplicaLagSettings `access:"environment_database,write_restrictable,cloud_restrictable"` // telemetry: none } func (s *SqlSettings) SetDefaults(isUpdate bool) { @@ -1082,7 +1157,7 @@ func (s *SqlSettings) SetDefaults(isUpdate bool) { if isUpdate { // When updating an existing configuration, ensure an encryption key has been specified. - if s.AtRestEncryptKey == nil || len(*s.AtRestEncryptKey) == 0 { + if s.AtRestEncryptKey == nil || *s.AtRestEncryptKey == "" { s.AtRestEncryptKey = NewString(NewRandomString(32)) } } else { @@ -1102,6 +1177,10 @@ func (s *SqlSettings) SetDefaults(isUpdate bool) { s.ConnMaxLifetimeMilliseconds = NewInt(3600000) } + if s.ConnMaxIdleTimeMilliseconds == nil { + s.ConnMaxIdleTimeMilliseconds = NewInt(300000) + } + if s.Trace == nil { s.Trace = NewBool(false) } @@ -1113,20 +1192,25 @@ func (s *SqlSettings) SetDefaults(isUpdate bool) { if s.DisableDatabaseSearch == nil { s.DisableDatabaseSearch = NewBool(false) } + + if s.ReplicaLagSettings == nil { + s.ReplicaLagSettings = []*ReplicaLagSettings{} + } } type LogSettings struct { - EnableConsole *bool `access:"environment,write_restrictable,cloud_restrictable"` - ConsoleLevel *string `access:"environment,write_restrictable,cloud_restrictable"` - ConsoleJson *bool `access:"environment,write_restrictable,cloud_restrictable"` - EnableFile *bool `access:"environment,write_restrictable,cloud_restrictable"` - FileLevel *string `access:"environment,write_restrictable,cloud_restrictable"` - FileJson *bool `access:"environment,write_restrictable,cloud_restrictable"` - FileLocation *string `access:"environment,write_restrictable,cloud_restrictable"` - EnableWebhookDebugging *bool `access:"environment,write_restrictable,cloud_restrictable"` - EnableDiagnostics *bool `access:"environment,write_restrictable,cloud_restrictable"` - EnableSentry *bool `access:"environment,write_restrictable,cloud_restrictable"` - AdvancedLoggingConfig *string `access:"environment,write_restrictable,cloud_restrictable"` + EnableConsole *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` + ConsoleLevel *string `access:"environment_logging,write_restrictable,cloud_restrictable"` + ConsoleJson *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` + EnableColor *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` // telemetry: none + EnableFile *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` + FileLevel *string `access:"environment_logging,write_restrictable,cloud_restrictable"` + FileJson *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` + FileLocation *string `access:"environment_logging,write_restrictable,cloud_restrictable"` + EnableWebhookDebugging *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` + EnableDiagnostics *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` // telemetry: none + EnableSentry *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` // telemetry: none + AdvancedLoggingConfig *string `access:"environment_logging,write_restrictable,cloud_restrictable"` } func (s *LogSettings) SetDefaults() { @@ -1138,6 +1222,10 @@ func (s *LogSettings) SetDefaults() { s.ConsoleLevel = NewString("DEBUG") } + if s.EnableColor == nil { + s.EnableColor = NewBool(false) + } + if s.EnableFile == nil { s.EnableFile = NewBool(true) } @@ -1176,14 +1264,14 @@ func (s *LogSettings) SetDefaults() { } type ExperimentalAuditSettings struct { - FileEnabled *bool `access:"experimental,write_restrictable,cloud_restrictable"` - FileName *string `access:"experimental,write_restrictable,cloud_restrictable"` - FileMaxSizeMB *int `access:"experimental,write_restrictable,cloud_restrictable"` - FileMaxAgeDays *int `access:"experimental,write_restrictable,cloud_restrictable"` - FileMaxBackups *int `access:"experimental,write_restrictable,cloud_restrictable"` - FileCompress *bool `access:"experimental,write_restrictable,cloud_restrictable"` - FileMaxQueueSize *int `access:"experimental,write_restrictable,cloud_restrictable"` - AdvancedLoggingConfig *string `access:"experimental,write_restrictable,cloud_restrictable"` + FileEnabled *bool `access:"experimental_features,write_restrictable,cloud_restrictable"` + FileName *string `access:"experimental_features,write_restrictable,cloud_restrictable"` // telemetry: none + FileMaxSizeMB *int `access:"experimental_features,write_restrictable,cloud_restrictable"` + FileMaxAgeDays *int `access:"experimental_features,write_restrictable,cloud_restrictable"` + FileMaxBackups *int `access:"experimental_features,write_restrictable,cloud_restrictable"` + FileCompress *bool `access:"experimental_features,write_restrictable,cloud_restrictable"` + FileMaxQueueSize *int `access:"experimental_features,write_restrictable,cloud_restrictable"` + AdvancedLoggingConfig *string `access:"experimental_features,write_restrictable,cloud_restrictable"` } func (s *ExperimentalAuditSettings) SetDefaults() { @@ -1224,6 +1312,7 @@ type NotificationLogSettings struct { EnableConsole *bool `access:"write_restrictable,cloud_restrictable"` ConsoleLevel *string `access:"write_restrictable,cloud_restrictable"` ConsoleJson *bool `access:"write_restrictable,cloud_restrictable"` + EnableColor *bool `access:"write_restrictable,cloud_restrictable"` // telemetry: none EnableFile *bool `access:"write_restrictable,cloud_restrictable"` FileLevel *string `access:"write_restrictable,cloud_restrictable"` FileJson *bool `access:"write_restrictable,cloud_restrictable"` @@ -1256,6 +1345,10 @@ func (s *NotificationLogSettings) SetDefaults() { s.ConsoleJson = NewBool(true) } + if s.EnableColor == nil { + s.EnableColor = NewBool(false) + } + if s.FileJson == nil { s.FileJson = NewBool(true) } @@ -1266,11 +1359,11 @@ func (s *NotificationLogSettings) SetDefaults() { } type PasswordSettings struct { - MinimumLength *int `access:"authentication"` - Lowercase *bool `access:"authentication"` - Number *bool `access:"authentication"` - Uppercase *bool `access:"authentication"` - Symbol *bool `access:"authentication"` + MinimumLength *int `access:"authentication_password"` + Lowercase *bool `access:"authentication_password"` + Number *bool `access:"authentication_password"` + Uppercase *bool `access:"authentication_password"` + Symbol *bool `access:"authentication_password"` } func (s *PasswordSettings) SetDefaults() { @@ -1296,25 +1389,27 @@ func (s *PasswordSettings) SetDefaults() { } type FileSettings struct { - EnableFileAttachments *bool `access:"site,cloud_restrictable"` - EnableMobileUpload *bool `access:"site,cloud_restrictable"` - EnableMobileDownload *bool `access:"site,cloud_restrictable"` - MaxFileSize *int64 `access:"environment,cloud_restrictable"` - DriverName *string `access:"environment,write_restrictable,cloud_restrictable"` - Directory *string `access:"environment,write_restrictable,cloud_restrictable"` - EnablePublicLink *bool `access:"site,cloud_restrictable"` - PublicLinkSalt *string `access:"site,cloud_restrictable"` - InitialFont *string `access:"environment,cloud_restrictable"` - AmazonS3AccessKeyId *string `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3SecretAccessKey *string `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3Bucket *string `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3PathPrefix *string `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3Region *string `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3Endpoint *string `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3SSL *bool `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3SignV2 *bool `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3SSE *bool `access:"environment,write_restrictable,cloud_restrictable"` - AmazonS3Trace *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableFileAttachments *bool `access:"site_file_sharing_and_downloads,cloud_restrictable"` + EnableMobileUpload *bool `access:"site_file_sharing_and_downloads,cloud_restrictable"` + EnableMobileDownload *bool `access:"site_file_sharing_and_downloads,cloud_restrictable"` + MaxFileSize *int64 `access:"environment_file_storage,cloud_restrictable"` + DriverName *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` + Directory *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` + EnablePublicLink *bool `access:"site_public_links,cloud_restrictable"` + ExtractContent *bool `access:"environment_file_storage,write_restrictable"` + ArchiveRecursion *bool `access:"environment_file_storage,write_restrictable"` + PublicLinkSalt *string `access:"site_public_links,cloud_restrictable"` // telemetry: none + InitialFont *string `access:"environment_file_storage,cloud_restrictable"` // telemetry: none + AmazonS3AccessKeyId *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none + AmazonS3SecretAccessKey *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none + AmazonS3Bucket *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none + AmazonS3PathPrefix *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none + AmazonS3Region *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none + AmazonS3Endpoint *string `access:"environment_file_storage,write_restrictable,cloud_restrictable"` // telemetry: none + AmazonS3SSL *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"` + AmazonS3SignV2 *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"` + AmazonS3SSE *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"` + AmazonS3Trace *bool `access:"environment_file_storage,write_restrictable,cloud_restrictable"` } func (s *FileSettings) SetDefaults(isUpdate bool) { @@ -1331,7 +1426,7 @@ func (s *FileSettings) SetDefaults(isUpdate bool) { } if s.MaxFileSize == nil { - s.MaxFileSize = NewInt64(52428800) // 50 MB + s.MaxFileSize = NewInt64(MB * 100) } if s.DriverName == nil { @@ -1346,9 +1441,17 @@ func (s *FileSettings) SetDefaults(isUpdate bool) { s.EnablePublicLink = NewBool(false) } + if s.ExtractContent == nil { + s.ExtractContent = NewBool(true) + } + + if s.ArchiveRecursion == nil { + s.ArchiveRecursion = NewBool(false) + } + if isUpdate { // When updating an existing configuration, ensure link salt has been specified. - if s.PublicLinkSalt == nil || len(*s.PublicLinkSalt) == 0 { + if s.PublicLinkSalt == nil || *s.PublicLinkSalt == "" { s.PublicLinkSalt = NewString(NewRandomString(32)) } } else { @@ -1381,7 +1484,7 @@ func (s *FileSettings) SetDefaults(isUpdate bool) { s.AmazonS3Region = NewString("") } - if s.AmazonS3Endpoint == nil || len(*s.AmazonS3Endpoint) == 0 { + if s.AmazonS3Endpoint == nil || *s.AmazonS3Endpoint == "" { // Defaults to "s3.amazonaws.com" s.AmazonS3Endpoint = NewString("s3.amazonaws.com") } @@ -1404,37 +1507,59 @@ func (s *FileSettings) SetDefaults(isUpdate bool) { } } +func (s *FileSettings) ToFileBackendSettings(enableComplianceFeature bool) filestore.FileBackendSettings { + if *s.DriverName == IMAGE_DRIVER_LOCAL { + return filestore.FileBackendSettings{ + DriverName: *s.DriverName, + Directory: *s.Directory, + } + } + return filestore.FileBackendSettings{ + DriverName: *s.DriverName, + AmazonS3AccessKeyId: *s.AmazonS3AccessKeyId, + AmazonS3SecretAccessKey: *s.AmazonS3SecretAccessKey, + AmazonS3Bucket: *s.AmazonS3Bucket, + AmazonS3PathPrefix: *s.AmazonS3PathPrefix, + AmazonS3Region: *s.AmazonS3Region, + AmazonS3Endpoint: *s.AmazonS3Endpoint, + AmazonS3SSL: s.AmazonS3SSL == nil || *s.AmazonS3SSL, + AmazonS3SignV2: s.AmazonS3SignV2 != nil && *s.AmazonS3SignV2, + AmazonS3SSE: s.AmazonS3SSE != nil && *s.AmazonS3SSE && enableComplianceFeature, + AmazonS3Trace: s.AmazonS3Trace != nil && *s.AmazonS3Trace, + } +} + type EmailSettings struct { - EnableSignUpWithEmail *bool `access:"authentication"` - EnableSignInWithEmail *bool `access:"authentication"` - EnableSignInWithUsername *bool `access:"authentication"` - SendEmailNotifications *bool `access:"site"` - UseChannelInEmailNotifications *bool `access:"experimental"` - RequireEmailVerification *bool `access:"authentication"` - FeedbackName *string `access:"site"` - FeedbackEmail *string `access:"site,cloud_restrictable"` - ReplyToAddress *string `access:"site,cloud_restrictable"` - FeedbackOrganization *string `access:"site"` - EnableSMTPAuth *bool `access:"environment,write_restrictable,cloud_restrictable"` - SMTPUsername *string `access:"environment,write_restrictable,cloud_restrictable"` - SMTPPassword *string `access:"environment,write_restrictable,cloud_restrictable"` - SMTPServer *string `access:"environment,write_restrictable,cloud_restrictable"` - SMTPPort *string `access:"environment,write_restrictable,cloud_restrictable"` + EnableSignUpWithEmail *bool `access:"authentication_email"` + EnableSignInWithEmail *bool `access:"authentication_email"` + EnableSignInWithUsername *bool `access:"authentication_email"` + SendEmailNotifications *bool `access:"site_notifications"` + UseChannelInEmailNotifications *bool `access:"experimental_features"` + RequireEmailVerification *bool `access:"authentication_email"` + FeedbackName *string `access:"site_notifications"` + FeedbackEmail *string `access:"site_notifications,cloud_restrictable"` + ReplyToAddress *string `access:"site_notifications,cloud_restrictable"` + FeedbackOrganization *string `access:"site_notifications"` + EnableSMTPAuth *bool `access:"environment_smtp,write_restrictable,cloud_restrictable"` + SMTPUsername *string `access:"environment_smtp,write_restrictable,cloud_restrictable"` // telemetry: none + SMTPPassword *string `access:"environment_smtp,write_restrictable,cloud_restrictable"` // telemetry: none + SMTPServer *string `access:"environment_smtp,write_restrictable,cloud_restrictable"` // telemetry: none + SMTPPort *string `access:"environment_smtp,write_restrictable,cloud_restrictable"` // telemetry: none SMTPServerTimeout *int `access:"cloud_restrictable"` - ConnectionSecurity *string `access:"environment,write_restrictable,cloud_restrictable"` - SendPushNotifications *bool `access:"environment"` - PushNotificationServer *string `access:"environment"` - PushNotificationContents *string `access:"site"` - PushNotificationBuffer *int - EnableEmailBatching *bool `access:"site"` - EmailBatchingBufferSize *int `access:"experimental"` - EmailBatchingInterval *int `access:"experimental"` - EnablePreviewModeBanner *bool `access:"site"` - SkipServerCertificateVerification *bool `access:"environment,write_restrictable,cloud_restrictable"` - EmailNotificationContentsType *string `access:"site"` - LoginButtonColor *string `access:"experimental"` - LoginButtonBorderColor *string `access:"experimental"` - LoginButtonTextColor *string `access:"experimental"` + ConnectionSecurity *string `access:"environment_smtp,write_restrictable,cloud_restrictable"` + SendPushNotifications *bool `access:"environment_push_notification_server"` + PushNotificationServer *string `access:"environment_push_notification_server"` // telemetry: none + PushNotificationContents *string `access:"site_notifications"` + PushNotificationBuffer *int // telemetry: none + EnableEmailBatching *bool `access:"site_notifications"` + EmailBatchingBufferSize *int `access:"experimental_features"` + EmailBatchingInterval *int `access:"experimental_features"` + EnablePreviewModeBanner *bool `access:"site_notifications"` + SkipServerCertificateVerification *bool `access:"environment_smtp,write_restrictable,cloud_restrictable"` + EmailNotificationContentsType *string `access:"site_notifications"` + LoginButtonColor *string `access:"experimental_features"` + LoginButtonBorderColor *string `access:"experimental_features"` + LoginButtonTextColor *string `access:"experimental_features"` } func (s *EmailSettings) SetDefaults(isUpdate bool) { @@ -1494,11 +1619,11 @@ func (s *EmailSettings) SetDefaults(isUpdate bool) { s.SMTPPassword = NewString("") } - if s.SMTPServer == nil || len(*s.SMTPServer) == 0 { + if s.SMTPServer == nil || *s.SMTPServer == "" { s.SMTPServer = NewString("localhost") } - if s.SMTPPort == nil || len(*s.SMTPPort) == 0 { + if s.SMTPPort == nil || *s.SMTPPort == "" { s.SMTPPort = NewString("10025") } @@ -1580,13 +1705,13 @@ func (s *EmailSettings) SetDefaults(isUpdate bool) { } type RateLimitSettings struct { - Enable *bool `access:"environment,write_restrictable,cloud_restrictable"` - PerSec *int `access:"environment,write_restrictable,cloud_restrictable"` - MaxBurst *int `access:"environment,write_restrictable,cloud_restrictable"` - MemoryStoreSize *int `access:"environment,write_restrictable,cloud_restrictable"` - VaryByRemoteAddr *bool `access:"environment,write_restrictable,cloud_restrictable"` - VaryByUser *bool `access:"environment,write_restrictable,cloud_restrictable"` - VaryByHeader string `access:"environment,write_restrictable,cloud_restrictable"` + Enable *bool `access:"environment_rate_limiting,write_restrictable,cloud_restrictable"` + PerSec *int `access:"environment_rate_limiting,write_restrictable,cloud_restrictable"` + MaxBurst *int `access:"environment_rate_limiting,write_restrictable,cloud_restrictable"` + MemoryStoreSize *int `access:"environment_rate_limiting,write_restrictable,cloud_restrictable"` + VaryByRemoteAddr *bool `access:"environment_rate_limiting,write_restrictable,cloud_restrictable"` + VaryByUser *bool `access:"environment_rate_limiting,write_restrictable,cloud_restrictable"` + VaryByHeader string `access:"environment_rate_limiting,write_restrictable,cloud_restrictable"` } func (s *RateLimitSettings) SetDefaults() { @@ -1616,8 +1741,8 @@ func (s *RateLimitSettings) SetDefaults() { } type PrivacySettings struct { - ShowEmailAddress *bool `access:"site"` - ShowFullName *bool `access:"site"` + ShowEmailAddress *bool `access:"site_users_and_teams"` + ShowFullName *bool `access:"site_users_and_teams"` } func (s *PrivacySettings) setDefaults() { @@ -1631,15 +1756,15 @@ func (s *PrivacySettings) setDefaults() { } type SupportSettings struct { - TermsOfServiceLink *string `access:"site,write_restrictable,cloud_restrictable"` - PrivacyPolicyLink *string `access:"site,write_restrictable,cloud_restrictable"` - AboutLink *string `access:"site,write_restrictable,cloud_restrictable"` - HelpLink *string `access:"site,write_restrictable,cloud_restrictable"` - ReportAProblemLink *string `access:"site,write_restrictable,cloud_restrictable"` - SupportEmail *string `access:"site"` - CustomTermsOfServiceEnabled *bool `access:"compliance"` - CustomTermsOfServiceReAcceptancePeriod *int `access:"compliance"` - EnableAskCommunityLink *bool `access:"site"` + TermsOfServiceLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + PrivacyPolicyLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + AboutLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + HelpLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + ReportAProblemLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + SupportEmail *string `access:"site_customization"` + CustomTermsOfServiceEnabled *bool `access:"compliance_custom_terms_of_service"` + CustomTermsOfServiceReAcceptancePeriod *int `access:"compliance_custom_terms_of_service"` + EnableAskCommunityLink *bool `access:"site_customization"` } func (s *SupportSettings) SetDefaults() { @@ -1701,16 +1826,16 @@ func (s *SupportSettings) SetDefaults() { } type AnnouncementSettings struct { - EnableBanner *bool `access:"site"` - BannerText *string `access:"site"` - BannerColor *string `access:"site"` - BannerTextColor *string `access:"site"` - AllowBannerDismissal *bool `access:"site"` - AdminNoticesEnabled *bool `access:"site"` - UserNoticesEnabled *bool `access:"site"` - NoticesURL *string `access:"site,write_restrictable"` - NoticesFetchFrequency *int `access:"site,write_restrictable"` - NoticesSkipCache *bool `access:"site,write_restrictable"` + EnableBanner *bool `access:"site_announcement_banner"` + BannerText *string `access:"site_announcement_banner"` // telemetry: none + BannerColor *string `access:"site_announcement_banner"` + BannerTextColor *string `access:"site_announcement_banner"` + AllowBannerDismissal *bool `access:"site_announcement_banner"` + AdminNoticesEnabled *bool `access:"site_notices"` + UserNoticesEnabled *bool `access:"site_notices"` + NoticesURL *string `access:"site_notices,write_restrictable"` // telemetry: none + NoticesFetchFrequency *int `access:"site_notices,write_restrictable"` // telemetry: none + NoticesSkipCache *bool `access:"site_notices,write_restrictable"` // telemetry: none } func (s *AnnouncementSettings) SetDefaults() { @@ -1754,9 +1879,9 @@ func (s *AnnouncementSettings) SetDefaults() { } type ThemeSettings struct { - EnableThemeSelection *bool `access:"experimental"` - DefaultTheme *string `access:"experimental"` - AllowCustomThemes *bool `access:"experimental"` + EnableThemeSelection *bool `access:"experimental_features"` + DefaultTheme *string `access:"experimental_features"` + AllowCustomThemes *bool `access:"experimental_features"` AllowedThemes []string } @@ -1779,38 +1904,39 @@ func (s *ThemeSettings) SetDefaults() { } type TeamSettings struct { - SiteName *string `access:"site"` - MaxUsersPerTeam *int `access:"site"` - DEPRECATED_DO_NOT_USE_EnableTeamCreation *bool `json:"EnableTeamCreation" mapstructure:"EnableTeamCreation"` // This field is deprecated and must not be used. - EnableUserCreation *bool `access:"authentication"` - EnableOpenServer *bool `access:"authentication"` - EnableUserDeactivation *bool `access:"experimental"` - RestrictCreationToDomains *string `access:"authentication"` - EnableCustomBrand *bool `access:"site"` - CustomBrandText *string `access:"site"` - CustomDescriptionText *string `access:"site"` - RestrictDirectMessage *string `access:"site"` - DEPRECATED_DO_NOT_USE_RestrictTeamInvite *string `json:"RestrictTeamInvite" mapstructure:"RestrictTeamInvite"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement *string `json:"RestrictPublicChannelManagement" mapstructure:"RestrictPublicChannelManagement"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement *string `json:"RestrictPrivateChannelManagement" mapstructure:"RestrictPrivateChannelManagement"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation *string `json:"RestrictPublicChannelCreation" mapstructure:"RestrictPublicChannelCreation"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation *string `json:"RestrictPrivateChannelCreation" mapstructure:"RestrictPrivateChannelCreation"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion *string `json:"RestrictPublicChannelDeletion" mapstructure:"RestrictPublicChannelDeletion"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion *string `json:"RestrictPrivateChannelDeletion" mapstructure:"RestrictPrivateChannelDeletion"` // This field is deprecated and must not be used. - DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers *string `json:"RestrictPrivateChannelManageMembers" mapstructure:"RestrictPrivateChannelManageMembers"` // This field is deprecated and must not be used. - EnableXToLeaveChannelsFromLHS *bool `access:"experimental"` - UserStatusAwayTimeout *int64 `access:"experimental"` - MaxChannelsPerTeam *int64 `access:"site"` - MaxNotificationsPerChannel *int64 `access:"environment"` - EnableConfirmNotificationsToChannel *bool `access:"site"` - TeammateNameDisplay *string `access:"site"` - ExperimentalViewArchivedChannels *bool `access:"experimental,site"` - ExperimentalEnableAutomaticReplies *bool `access:"experimental"` - ExperimentalHideTownSquareinLHS *bool `access:"experimental"` - ExperimentalTownSquareIsReadOnly *bool `access:"experimental"` - LockTeammateNameDisplay *bool `access:"site"` - ExperimentalPrimaryTeam *string `access:"experimental"` - ExperimentalDefaultChannels []string `access:"experimental"` + SiteName *string `access:"site_customization"` + MaxUsersPerTeam *int `access:"site_users_and_teams"` + DEPRECATED_DO_NOT_USE_EnableTeamCreation *bool `json:"EnableTeamCreation" mapstructure:"EnableTeamCreation"` // Deprecated: do not use + EnableUserCreation *bool `access:"authentication_signup"` + EnableOpenServer *bool `access:"authentication_signup"` + EnableUserDeactivation *bool `access:"experimental_features"` + RestrictCreationToDomains *string `access:"authentication_signup"` // telemetry: none + EnableCustomUserStatuses *bool `access:"site_users_and_teams"` + EnableCustomBrand *bool `access:"site_customization"` + CustomBrandText *string `access:"site_customization"` + CustomDescriptionText *string `access:"site_customization"` + RestrictDirectMessage *string `access:"site_users_and_teams"` + DEPRECATED_DO_NOT_USE_RestrictTeamInvite *string `json:"RestrictTeamInvite" mapstructure:"RestrictTeamInvite"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement *string `json:"RestrictPublicChannelManagement" mapstructure:"RestrictPublicChannelManagement"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement *string `json:"RestrictPrivateChannelManagement" mapstructure:"RestrictPrivateChannelManagement"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation *string `json:"RestrictPublicChannelCreation" mapstructure:"RestrictPublicChannelCreation"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation *string `json:"RestrictPrivateChannelCreation" mapstructure:"RestrictPrivateChannelCreation"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion *string `json:"RestrictPublicChannelDeletion" mapstructure:"RestrictPublicChannelDeletion"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion *string `json:"RestrictPrivateChannelDeletion" mapstructure:"RestrictPrivateChannelDeletion"` // Deprecated: do not use + DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers *string `json:"RestrictPrivateChannelManageMembers" mapstructure:"RestrictPrivateChannelManageMembers"` // Deprecated: do not use + EnableXToLeaveChannelsFromLHS *bool `access:"experimental_features"` + UserStatusAwayTimeout *int64 `access:"experimental_features"` + MaxChannelsPerTeam *int64 `access:"site_users_and_teams"` + MaxNotificationsPerChannel *int64 `access:"environment_push_notification_server"` + EnableConfirmNotificationsToChannel *bool `access:"site_notifications"` + TeammateNameDisplay *string `access:"site_users_and_teams"` + ExperimentalViewArchivedChannels *bool `access:"experimental_features,site_users_and_teams"` + ExperimentalEnableAutomaticReplies *bool `access:"experimental_features"` + ExperimentalHideTownSquareinLHS *bool `access:"experimental_features"` + ExperimentalTownSquareIsReadOnly *bool `access:"experimental_features"` + LockTeammateNameDisplay *bool `access:"site_users_and_teams"` + ExperimentalPrimaryTeam *string `access:"experimental_features"` + ExperimentalDefaultChannels []string `access:"experimental_features"` } func (s *TeamSettings) SetDefaults() { @@ -1839,6 +1965,10 @@ func (s *TeamSettings) SetDefaults() { s.RestrictCreationToDomains = NewString("") } + if s.EnableCustomUserStatuses == nil { + s.EnableCustomUserStatuses = NewBool(true) + } + if s.EnableCustomBrand == nil { s.EnableCustomBrand = NewBool(false) } @@ -1972,55 +2102,55 @@ type ClientRequirements struct { type LdapSettings struct { // Basic - Enable *bool `access:"authentication"` - EnableSync *bool `access:"authentication"` - LdapServer *string `access:"authentication"` - LdapPort *int `access:"authentication"` - ConnectionSecurity *string `access:"authentication"` - BaseDN *string `access:"authentication"` - BindUsername *string `access:"authentication"` - BindPassword *string `access:"authentication"` + Enable *bool `access:"authentication_ldap"` + EnableSync *bool `access:"authentication_ldap"` + LdapServer *string `access:"authentication_ldap"` // telemetry: none + LdapPort *int `access:"authentication_ldap"` // telemetry: none + ConnectionSecurity *string `access:"authentication_ldap"` + BaseDN *string `access:"authentication_ldap"` // telemetry: none + BindUsername *string `access:"authentication_ldap"` // telemetry: none + BindPassword *string `access:"authentication_ldap"` // telemetry: none // Filtering - UserFilter *string `access:"authentication"` - GroupFilter *string `access:"authentication"` - GuestFilter *string `access:"authentication"` + UserFilter *string `access:"authentication_ldap"` // telemetry: none + GroupFilter *string `access:"authentication_ldap"` + GuestFilter *string `access:"authentication_ldap"` EnableAdminFilter *bool AdminFilter *string // Group Mapping - GroupDisplayNameAttribute *string `access:"authentication"` - GroupIdAttribute *string `access:"authentication"` + GroupDisplayNameAttribute *string `access:"authentication_ldap"` + GroupIdAttribute *string `access:"authentication_ldap"` // User Mapping - FirstNameAttribute *string `access:"authentication"` - LastNameAttribute *string `access:"authentication"` - EmailAttribute *string `access:"authentication"` - UsernameAttribute *string `access:"authentication"` - NicknameAttribute *string `access:"authentication"` - IdAttribute *string `access:"authentication"` - PositionAttribute *string `access:"authentication"` - LoginIdAttribute *string `access:"authentication"` - PictureAttribute *string `access:"authentication"` + FirstNameAttribute *string `access:"authentication_ldap"` + LastNameAttribute *string `access:"authentication_ldap"` + EmailAttribute *string `access:"authentication_ldap"` + UsernameAttribute *string `access:"authentication_ldap"` + NicknameAttribute *string `access:"authentication_ldap"` + IdAttribute *string `access:"authentication_ldap"` + PositionAttribute *string `access:"authentication_ldap"` + LoginIdAttribute *string `access:"authentication_ldap"` + PictureAttribute *string `access:"authentication_ldap"` // Synchronization - SyncIntervalMinutes *int `access:"authentication"` + SyncIntervalMinutes *int `access:"authentication_ldap"` // Advanced - SkipCertificateVerification *bool `access:"authentication"` - PublicCertificateFile *string `access:"authentication"` - PrivateKeyFile *string `access:"authentication"` - QueryTimeout *int `access:"authentication"` - MaxPageSize *int `access:"authentication"` + SkipCertificateVerification *bool `access:"authentication_ldap"` + PublicCertificateFile *string `access:"authentication_ldap"` + PrivateKeyFile *string `access:"authentication_ldap"` + QueryTimeout *int `access:"authentication_ldap"` + MaxPageSize *int `access:"authentication_ldap"` // Customization - LoginFieldName *string `access:"authentication"` + LoginFieldName *string `access:"authentication_ldap"` - LoginButtonColor *string `access:"authentication"` - LoginButtonBorderColor *string `access:"authentication"` - LoginButtonTextColor *string `access:"authentication"` + LoginButtonColor *string `access:"experimental_features"` + LoginButtonBorderColor *string `access:"experimental_features"` + LoginButtonTextColor *string `access:"experimental_features"` - Trace *bool `access:"authentication"` + Trace *bool `access:"authentication_ldap"` // telemetry: none } func (s *LdapSettings) SetDefaults() { @@ -2169,9 +2299,10 @@ func (s *LdapSettings) SetDefaults() { } type ComplianceSettings struct { - Enable *bool `access:"compliance"` - Directory *string `access:"compliance"` - EnableDaily *bool `access:"compliance"` + Enable *bool `access:"compliance_compliance_monitoring"` + Directory *string `access:"compliance_compliance_monitoring"` // telemetry: none + EnableDaily *bool `access:"compliance_compliance_monitoring"` + BatchSize *int `access:"compliance_compliance_monitoring"` // telemetry: none } func (s *ComplianceSettings) SetDefaults() { @@ -2186,12 +2317,16 @@ func (s *ComplianceSettings) SetDefaults() { if s.EnableDaily == nil { s.EnableDaily = NewBool(false) } + + if s.BatchSize == nil { + s.BatchSize = NewInt(30000) + } } type LocalizationSettings struct { - DefaultServerLocale *string `access:"site"` - DefaultClientLocale *string `access:"site"` - AvailableLocales *string `access:"site"` + DefaultServerLocale *string `access:"site_localization"` + DefaultClientLocale *string `access:"site_localization"` + AvailableLocales *string `access:"site_localization"` } func (s *LocalizationSettings) SetDefaults() { @@ -2210,49 +2345,49 @@ func (s *LocalizationSettings) SetDefaults() { type SamlSettings struct { // Basic - Enable *bool `access:"authentication"` - EnableSyncWithLdap *bool `access:"authentication"` - EnableSyncWithLdapIncludeAuth *bool `access:"authentication"` - IgnoreGuestsLdapSync *bool `access:"authentication"` + Enable *bool `access:"authentication_saml"` + EnableSyncWithLdap *bool `access:"authentication_saml"` + EnableSyncWithLdapIncludeAuth *bool `access:"authentication_saml"` + IgnoreGuestsLdapSync *bool `access:"authentication_saml"` - Verify *bool `access:"authentication"` - Encrypt *bool `access:"authentication"` - SignRequest *bool `access:"authentication"` + Verify *bool `access:"authentication_saml"` + Encrypt *bool `access:"authentication_saml"` + SignRequest *bool `access:"authentication_saml"` - IdpUrl *string `access:"authentication"` - IdpDescriptorUrl *string `access:"authentication"` - IdpMetadataUrl *string `access:"authentication"` - ServiceProviderIdentifier *string `access:"authentication"` - AssertionConsumerServiceURL *string `access:"authentication"` + IdpUrl *string `access:"authentication_saml"` // telemetry: none + IdpDescriptorUrl *string `access:"authentication_saml"` // telemetry: none + IdpMetadataUrl *string `access:"authentication_saml"` // telemetry: none + ServiceProviderIdentifier *string `access:"authentication_saml"` // telemetry: none + AssertionConsumerServiceURL *string `access:"authentication_saml"` // telemetry: none - SignatureAlgorithm *string `access:"authentication"` - CanonicalAlgorithm *string `access:"authentication"` + SignatureAlgorithm *string `access:"authentication_saml"` + CanonicalAlgorithm *string `access:"authentication_saml"` - ScopingIDPProviderId *string `access:"authentication"` - ScopingIDPName *string `access:"authentication"` + ScopingIDPProviderId *string `access:"authentication_saml"` + ScopingIDPName *string `access:"authentication_saml"` - IdpCertificateFile *string `access:"authentication"` - PublicCertificateFile *string `access:"authentication"` - PrivateKeyFile *string `access:"authentication"` + IdpCertificateFile *string `access:"authentication_saml"` // telemetry: none + PublicCertificateFile *string `access:"authentication_saml"` // telemetry: none + PrivateKeyFile *string `access:"authentication_saml"` // telemetry: none // User Mapping - IdAttribute *string `access:"authentication"` - GuestAttribute *string `access:"authentication"` + IdAttribute *string `access:"authentication_saml"` + GuestAttribute *string `access:"authentication_saml"` EnableAdminAttribute *bool AdminAttribute *string - FirstNameAttribute *string `access:"authentication"` - LastNameAttribute *string `access:"authentication"` - EmailAttribute *string `access:"authentication"` - UsernameAttribute *string `access:"authentication"` - NicknameAttribute *string `access:"authentication"` - LocaleAttribute *string `access:"authentication"` - PositionAttribute *string `access:"authentication"` + FirstNameAttribute *string `access:"authentication_saml"` + LastNameAttribute *string `access:"authentication_saml"` + EmailAttribute *string `access:"authentication_saml"` + UsernameAttribute *string `access:"authentication_saml"` + NicknameAttribute *string `access:"authentication_saml"` + LocaleAttribute *string `access:"authentication_saml"` + PositionAttribute *string `access:"authentication_saml"` - LoginButtonText *string `access:"authentication"` + LoginButtonText *string `access:"authentication_saml"` - LoginButtonColor *string `access:"authentication"` - LoginButtonBorderColor *string `access:"authentication"` - LoginButtonTextColor *string `access:"authentication"` + LoginButtonColor *string `access:"experimental_features"` + LoginButtonBorderColor *string `access:"experimental_features"` + LoginButtonTextColor *string `access:"experimental_features"` } func (s *SamlSettings) SetDefaults() { @@ -2396,9 +2531,10 @@ func (s *SamlSettings) SetDefaults() { } type NativeAppSettings struct { - AppDownloadLink *string `access:"site,write_restrictable,cloud_restrictable"` - AndroidAppDownloadLink *string `access:"site,write_restrictable,cloud_restrictable"` - IosAppDownloadLink *string `access:"site,write_restrictable,cloud_restrictable"` + AppCustomURLSchemes []string `access:"site_customization,write_restrictable,cloud_restrictable"` // telemetry: none + AppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + AndroidAppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + IosAppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` } func (s *NativeAppSettings) SetDefaults() { @@ -2413,30 +2549,34 @@ func (s *NativeAppSettings) SetDefaults() { if s.IosAppDownloadLink == nil { s.IosAppDownloadLink = NewString(NATIVEAPP_SETTINGS_DEFAULT_IOS_APP_DOWNLOAD_LINK) } + + if s.AppCustomURLSchemes == nil { + s.AppCustomURLSchemes = GetDefaultAppCustomURLSchemes() + } } type ElasticsearchSettings struct { - ConnectionUrl *string `access:"environment,write_restrictable,cloud_restrictable"` - Username *string `access:"environment,write_restrictable,cloud_restrictable"` - Password *string `access:"environment,write_restrictable,cloud_restrictable"` - EnableIndexing *bool `access:"environment,write_restrictable,cloud_restrictable"` - EnableSearching *bool `access:"environment,write_restrictable,cloud_restrictable"` - EnableAutocomplete *bool `access:"environment,write_restrictable,cloud_restrictable"` - Sniff *bool `access:"environment,write_restrictable,cloud_restrictable"` - PostIndexReplicas *int `access:"environment,write_restrictable,cloud_restrictable"` - PostIndexShards *int `access:"environment,write_restrictable,cloud_restrictable"` - ChannelIndexReplicas *int `access:"environment,write_restrictable,cloud_restrictable"` - ChannelIndexShards *int `access:"environment,write_restrictable,cloud_restrictable"` - UserIndexReplicas *int `access:"environment,write_restrictable,cloud_restrictable"` - UserIndexShards *int `access:"environment,write_restrictable,cloud_restrictable"` - AggregatePostsAfterDays *int `access:"environment,write_restrictable,cloud_restrictable"` - PostsAggregatorJobStartTime *string `access:"environment,write_restrictable,cloud_restrictable"` - IndexPrefix *string `access:"environment,write_restrictable,cloud_restrictable"` - LiveIndexingBatchSize *int `access:"environment,write_restrictable,cloud_restrictable"` - BulkIndexingTimeWindowSeconds *int `access:"environment,write_restrictable,cloud_restrictable"` - RequestTimeoutSeconds *int `access:"environment,write_restrictable,cloud_restrictable"` - SkipTLSVerification *bool `access:"environment,write_restrictable,cloud_restrictable"` - Trace *string `access:"environment,write_restrictable,cloud_restrictable"` + ConnectionUrl *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + Username *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + Password *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + EnableIndexing *bool `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + EnableSearching *bool `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + EnableAutocomplete *bool `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + Sniff *bool `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + PostIndexReplicas *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + PostIndexShards *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + ChannelIndexReplicas *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + ChannelIndexShards *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + UserIndexReplicas *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + UserIndexShards *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + AggregatePostsAfterDays *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` // telemetry: none + PostsAggregatorJobStartTime *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` // telemetry: none + IndexPrefix *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + LiveIndexingBatchSize *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + BulkIndexingTimeWindowSeconds *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + RequestTimeoutSeconds *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + SkipTLSVerification *bool `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + Trace *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` } func (s *ElasticsearchSettings) SetDefaults() { @@ -2526,11 +2666,11 @@ func (s *ElasticsearchSettings) SetDefaults() { } type BleveSettings struct { - IndexDir *string `access:"experimental"` - EnableIndexing *bool `access:"experimental"` - EnableSearching *bool `access:"experimental"` - EnableAutocomplete *bool `access:"experimental"` - BulkIndexingTimeWindowSeconds *int `access:"experimental"` + IndexDir *string `access:"experimental_bleve"` // telemetry: none + EnableIndexing *bool `access:"experimental_bleve"` + EnableSearching *bool `access:"experimental_bleve"` + EnableAutocomplete *bool `access:"experimental_bleve"` + BulkIndexingTimeWindowSeconds *int `access:"experimental_bleve"` } func (bs *BleveSettings) SetDefaults() { @@ -2556,11 +2696,12 @@ func (bs *BleveSettings) SetDefaults() { } type DataRetentionSettings struct { - EnableMessageDeletion *bool `access:"compliance"` - EnableFileDeletion *bool `access:"compliance"` - MessageRetentionDays *int `access:"compliance"` - FileRetentionDays *int `access:"compliance"` - DeletionJobStartTime *string `access:"compliance"` + EnableMessageDeletion *bool `access:"compliance_data_retention_policy"` + EnableFileDeletion *bool `access:"compliance_data_retention_policy"` + MessageRetentionDays *int `access:"compliance_data_retention_policy"` + FileRetentionDays *int `access:"compliance_data_retention_policy"` + DeletionJobStartTime *string `access:"compliance_data_retention_policy"` + BatchSize *int `access:"compliance_data_retention_policy"` } func (s *DataRetentionSettings) SetDefaults() { @@ -2583,6 +2724,10 @@ func (s *DataRetentionSettings) SetDefaults() { if s.DeletionJobStartTime == nil { s.DeletionJobStartTime = NewString(DATA_RETENTION_SETTINGS_DEFAULT_DELETION_JOB_START_TIME) } + + if s.BatchSize == nil { + s.BatchSize = NewInt(DATA_RETENTION_SETTINGS_DEFAULT_BATCH_SIZE) + } } type JobSettings struct { @@ -2601,13 +2746,17 @@ func (s *JobSettings) SetDefaults() { } type CloudSettings struct { - CWSUrl *string `access:"environment,write_restrictable"` + CWSUrl *string `access:"write_restrictable"` + CWSAPIUrl *string `access:"write_restrictable"` } func (s *CloudSettings) SetDefaults() { if s.CWSUrl == nil { s.CWSUrl = NewString(CLOUD_SETTINGS_DEFAULT_CWS_URL) } + if s.CWSAPIUrl == nil { + s.CWSAPIUrl = NewString(CLOUD_SETTINGS_DEFAULT_CWS_API_URL) + } } type PluginState struct { @@ -2619,16 +2768,17 @@ type PluginSettings struct { EnableUploads *bool `access:"plugins,write_restrictable,cloud_restrictable"` AllowInsecureDownloadUrl *bool `access:"plugins,write_restrictable,cloud_restrictable"` EnableHealthCheck *bool `access:"plugins,write_restrictable,cloud_restrictable"` - Directory *string `access:"plugins,write_restrictable,cloud_restrictable"` - ClientDirectory *string `access:"plugins,write_restrictable,cloud_restrictable"` - Plugins map[string]map[string]interface{} `access:"plugins"` - PluginStates map[string]*PluginState `access:"plugins"` + Directory *string `access:"plugins,write_restrictable,cloud_restrictable"` // telemetry: none + ClientDirectory *string `access:"plugins,write_restrictable,cloud_restrictable"` // telemetry: none + Plugins map[string]map[string]interface{} `access:"plugins"` // telemetry: none + PluginStates map[string]*PluginState `access:"plugins"` // telemetry: none EnableMarketplace *bool `access:"plugins,write_restrictable,cloud_restrictable"` EnableRemoteMarketplace *bool `access:"plugins,write_restrictable,cloud_restrictable"` AutomaticPrepackagedPlugins *bool `access:"plugins,write_restrictable,cloud_restrictable"` RequirePluginSignature *bool `access:"plugins,write_restrictable,cloud_restrictable"` MarketplaceUrl *string `access:"plugins,write_restrictable,cloud_restrictable"` SignaturePublicKeyFiles []string `access:"plugins,write_restrictable,cloud_restrictable"` + ChimeraOAuthProxyUrl *string `access:"plugins,write_restrictable,cloud_restrictable"` } func (s *PluginSettings) SetDefaults(ls LogSettings) { @@ -2702,14 +2852,18 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) { if s.SignaturePublicKeyFiles == nil { s.SignaturePublicKeyFiles = []string{} } + + if s.ChimeraOAuthProxyUrl == nil { + s.ChimeraOAuthProxyUrl = NewString("") + } } type GlobalRelayMessageExportSettings struct { - CustomerType *string `access:"compliance"` // must be either A9 or A10, dictates SMTP server url - SmtpUsername *string `access:"compliance"` - SmtpPassword *string `access:"compliance"` - EmailAddress *string `access:"compliance"` // the address to send messages to - SMTPServerTimeout *int `access:"compliance"` + CustomerType *string `access:"compliance_compliance_export"` // must be either A9 or A10, dictates SMTP server url + SmtpUsername *string `access:"compliance_compliance_export"` + SmtpPassword *string `access:"compliance_compliance_export"` + EmailAddress *string `access:"compliance_compliance_export"` // the address to send messages to + SMTPServerTimeout *int `access:"compliance_compliance_export"` } func (s *GlobalRelayMessageExportSettings) SetDefaults() { @@ -2731,15 +2885,15 @@ func (s *GlobalRelayMessageExportSettings) SetDefaults() { } type MessageExportSettings struct { - EnableExport *bool `access:"compliance"` - ExportFormat *string `access:"compliance"` - DailyRunTime *string `access:"compliance"` - ExportFromTimestamp *int64 `access:"compliance"` - BatchSize *int `access:"compliance"` - DownloadExportResults *bool `access:"compliance"` + EnableExport *bool `access:"compliance_compliance_export"` + ExportFormat *string `access:"compliance_compliance_export"` + DailyRunTime *string `access:"compliance_compliance_export"` + ExportFromTimestamp *int64 `access:"compliance_compliance_export"` + BatchSize *int `access:"compliance_compliance_export"` + DownloadExportResults *bool `access:"compliance_compliance_export"` // formatter-specific settings - these are only expected to be non-nil if ExportFormat is set to the associated format - GlobalRelaySettings *GlobalRelayMessageExportSettings + GlobalRelaySettings *GlobalRelayMessageExportSettings `access:"compliance_compliance_export"` } func (s *MessageExportSettings) SetDefaults() { @@ -2774,8 +2928,8 @@ func (s *MessageExportSettings) SetDefaults() { } type DisplaySettings struct { - CustomUrlSchemes []string `access:"site"` - ExperimentalTimezone *bool `access:"experimental"` + CustomUrlSchemes []string `access:"site_customization"` + ExperimentalTimezone *bool `access:"experimental_features"` } func (s *DisplaySettings) SetDefaults() { @@ -2790,10 +2944,10 @@ func (s *DisplaySettings) SetDefaults() { } type GuestAccountsSettings struct { - Enable *bool `access:"authentication"` - AllowEmailAccounts *bool `access:"authentication"` - EnforceMultifactorAuthentication *bool `access:"authentication"` - RestrictCreationToDomains *string `access:"authentication"` + Enable *bool `access:"authentication_guest_access"` + AllowEmailAccounts *bool `access:"authentication_guest_access"` + EnforceMultifactorAuthentication *bool `access:"authentication_guest_access"` + RestrictCreationToDomains *string `access:"authentication_guest_access"` } func (s *GuestAccountsSettings) SetDefaults() { @@ -2815,10 +2969,10 @@ func (s *GuestAccountsSettings) SetDefaults() { } type ImageProxySettings struct { - Enable *bool `access:"environment"` - ImageProxyType *string `access:"environment"` - RemoteImageProxyURL *string `access:"environment"` - RemoteImageProxyOptions *string `access:"environment"` + Enable *bool `access:"environment_image_proxy"` + ImageProxyType *string `access:"environment_image_proxy"` + RemoteImageProxyURL *string `access:"environment_image_proxy"` + RemoteImageProxyOptions *string `access:"environment_image_proxy"` } func (s *ImageProxySettings) SetDefaults(ss ServiceSettings) { @@ -2855,19 +3009,89 @@ func (s *ImageProxySettings) SetDefaults(ss ServiceSettings) { } } +// ImportSettings defines configuration settings for file imports. +type ImportSettings struct { + // The directory where to store the imported files. + Directory *string + // The number of days to retain the imported files before deleting them. + RetentionDays *int +} + +func (s *ImportSettings) isValid() *AppError { + if *s.Directory == "" { + return NewAppError("Config.IsValid", "model.config.is_valid.import.directory.app_error", nil, "", http.StatusBadRequest) + } + + if *s.RetentionDays <= 0 { + return NewAppError("Config.IsValid", "model.config.is_valid.import.retention_days_too_low.app_error", nil, "", http.StatusBadRequest) + } + + return nil +} + +// SetDefaults applies the default settings to the struct. +func (s *ImportSettings) SetDefaults() { + if s.Directory == nil || *s.Directory == "" { + s.Directory = NewString(IMPORT_SETTINGS_DEFAULT_DIRECTORY) + } + + if s.RetentionDays == nil { + s.RetentionDays = NewInt(IMPORT_SETTINGS_DEFAULT_RETENTION_DAYS) + } +} + +// ExportSettings defines configuration settings for file exports. +type ExportSettings struct { + // The directory where to store the exported files. + Directory *string // telemetry: none + // The number of days to retain the exported files before deleting them. + RetentionDays *int +} + +func (s *ExportSettings) isValid() *AppError { + if *s.Directory == "" { + return NewAppError("Config.IsValid", "model.config.is_valid.export.directory.app_error", nil, "", http.StatusBadRequest) + } + + if *s.RetentionDays <= 0 { + return NewAppError("Config.IsValid", "model.config.is_valid.export.retention_days_too_low.app_error", nil, "", http.StatusBadRequest) + } + + return nil +} + +// SetDefaults applies the default settings to the struct. +func (s *ExportSettings) SetDefaults() { + if s.Directory == nil || *s.Directory == "" { + s.Directory = NewString(EXPORT_SETTINGS_DEFAULT_DIRECTORY) + } + + if s.RetentionDays == nil { + s.RetentionDays = NewInt(EXPORT_SETTINGS_DEFAULT_RETENTION_DAYS) + } +} + type ConfigFunc func() *Config const ConfigAccessTagType = "access" const ConfigAccessTagWriteRestrictable = "write_restrictable" const ConfigAccessTagCloudRestrictable = "cloud_restrictable" +// Allows read access if any PERMISSION_SYSCONSOLE_READ_* is allowed +const ConfigAccessTagAnySysConsoleRead = "*_read" + // Config fields support the 'access' tag with the following values corresponding to the suffix of the associated // PERMISSION_SYSCONSOLE_*_* permission Id: 'about', 'reporting', 'user_management_users', // 'user_management_groups', 'user_management_teams', 'user_management_channels', -// 'user_management_permissions', 'environment', 'site', 'authentication', 'plugins', +// 'user_management_permissions', 'environment_web_server', 'environment_database', 'environment_elasticsearch', +// 'environment_file_storage', 'environment_image_proxy', 'environment_smtp', 'environment_push_notification_server', +// 'environment_high_availability', 'environment_rate_limiting', 'environment_logging', 'environment_session_lengths', +// 'environment_performance_monitoring', 'environment_developer', 'site', 'authentication', 'plugins', // 'integrations', 'compliance', 'plugins', and 'experimental'. They grant read and/or write access to the config field // to roles without PERMISSION_MANAGE_SYSTEM. // +// The 'access' tag '*_read' checks for any SYSCONSOLE read permission and grants access if any read permission is allowed. +// // By default config values can be written with PERMISSION_MANAGE_SYSTEM, but if ExperimentalSettings.RestrictSystemAdmin is true // and the access tag contains the value 'write_restrictable', then even PERMISSION_MANAGE_SYSTEM does not grant write access. // @@ -2910,6 +3134,7 @@ type Config struct { GitLabSettings SSOSettings GoogleSettings SSOSettings Office365Settings Office365Settings + OpenIdSettings SSOSettings LdapSettings LdapSettings ComplianceSettings ComplianceSettings LocalizationSettings LocalizationSettings @@ -2923,13 +3148,15 @@ type Config struct { BleveSettings BleveSettings DataRetentionSettings DataRetentionSettings MessageExportSettings MessageExportSettings - JobSettings JobSettings + JobSettings JobSettings // telemetry: none PluginSettings PluginSettings DisplaySettings DisplaySettings GuestAccountsSettings GuestAccountsSettings ImageProxySettings ImageProxySettings - CloudSettings CloudSettings - FeatureFlags *FeatureFlags `json:",omitempty"` + CloudSettings CloudSettings // telemetry: none + FeatureFlags *FeatureFlags `access:"*_read" json:",omitempty"` + ImportSettings ImportSettings // telemetry: none + ExportSettings ExportSettings } func (o *Config) Clone() *Config { @@ -2965,6 +3192,8 @@ func (o *Config) GetSSOService(service string) *SSOSettings { return &o.GoogleSettings case SERVICE_OFFICE365: return o.Office365Settings.SSOSettings() + case SERVICE_OPENID: + return &o.OpenIdSettings } return nil @@ -3000,8 +3229,10 @@ func (o *Config) SetDefaults() { o.EmailSettings.SetDefaults(isUpdate) o.PrivacySettings.setDefaults() o.Office365Settings.setDefaults() - o.GitLabSettings.setDefaults("", "", "", "") - o.GoogleSettings.setDefaults(GOOGLE_SETTINGS_DEFAULT_SCOPE, GOOGLE_SETTINGS_DEFAULT_AUTH_ENDPOINT, GOOGLE_SETTINGS_DEFAULT_TOKEN_ENDPOINT, GOOGLE_SETTINGS_DEFAULT_USER_API_ENDPOINT) + o.Office365Settings.setDefaults() + o.GitLabSettings.setDefaults("", "", "", "", "") + o.GoogleSettings.setDefaults(GOOGLE_SETTINGS_DEFAULT_SCOPE, GOOGLE_SETTINGS_DEFAULT_AUTH_ENDPOINT, GOOGLE_SETTINGS_DEFAULT_TOKEN_ENDPOINT, GOOGLE_SETTINGS_DEFAULT_USER_API_ENDPOINT, "") + o.OpenIdSettings.setDefaults(OPENID_SETTINGS_DEFAULT_SCOPE, "", "", "", "#145DBF") o.ServiceSettings.SetDefaults(isUpdate) o.PasswordSettings.SetDefaults() o.TeamSettings.SetDefaults() @@ -3033,10 +3264,12 @@ func (o *Config) SetDefaults() { o.FeatureFlags = &FeatureFlags{} o.FeatureFlags.SetDefaults() } + o.ImportSettings.SetDefaults() + o.ExportSettings.SetDefaults() } func (o *Config) IsValid() *AppError { - if len(*o.ServiceSettings.SiteURL) == 0 && *o.EmailSettings.EnableEmailBatching { + if *o.ServiceSettings.SiteURL == "" && *o.EmailSettings.EnableEmailBatching { return NewAppError("Config.IsValid", "model.config.is_valid.site_url_email_batching.app_error", nil, "", http.StatusBadRequest) } @@ -3044,7 +3277,7 @@ 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 { + if *o.ServiceSettings.SiteURL == "" && *o.ServiceSettings.AllowCookiesForSubdomains { return NewAppError("Config.IsValid", "model.config.is_valid.allow_cookies_for_subdomains.app_error", nil, "", http.StatusBadRequest) } @@ -3100,7 +3333,7 @@ func (o *Config) IsValid() *AppError { return err } - if err := o.MessageExportSettings.isValid(o.FileSettings); err != nil { + if err := o.MessageExportSettings.isValid(); err != nil { return err } @@ -3111,6 +3344,10 @@ func (o *Config) IsValid() *AppError { if err := o.ImageProxySettings.isValid(); err != nil { return err } + + if err := o.ImportSettings.isValid(); err != nil { + return err + } return nil } @@ -3159,11 +3396,15 @@ func (s *SqlSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.sql_conn_max_lifetime_milliseconds.app_error", nil, "", http.StatusBadRequest) } + if *s.ConnMaxIdleTimeMilliseconds < 0 { + return NewAppError("Config.IsValid", "model.config.is_valid.sql_conn_max_idle_time_milliseconds.app_error", nil, "", http.StatusBadRequest) + } + if *s.QueryTimeout <= 0 { return NewAppError("Config.IsValid", "model.config.is_valid.sql_query_timeout.app_error", nil, "", http.StatusBadRequest) } - if len(*s.DataSource) == 0 { + if *s.DataSource == "" { return NewAppError("Config.IsValid", "model.config.is_valid.sql_data_src.app_error", nil, "", http.StatusBadRequest) } @@ -3292,47 +3533,47 @@ func (s *LdapSettings) isValid() *AppError { func (s *SamlSettings) isValid() *AppError { if *s.Enable { - if len(*s.IdpUrl) == 0 || !IsValidHttpUrl(*s.IdpUrl) { + if *s.IdpUrl == "" || !IsValidHttpUrl(*s.IdpUrl) { return NewAppError("Config.IsValid", "model.config.is_valid.saml_idp_url.app_error", nil, "", http.StatusBadRequest) } - if len(*s.IdpDescriptorUrl) == 0 || !IsValidHttpUrl(*s.IdpDescriptorUrl) { + if *s.IdpDescriptorUrl == "" || !IsValidHttpUrl(*s.IdpDescriptorUrl) { return NewAppError("Config.IsValid", "model.config.is_valid.saml_idp_descriptor_url.app_error", nil, "", http.StatusBadRequest) } - if len(*s.IdpCertificateFile) == 0 { + if *s.IdpCertificateFile == "" { return NewAppError("Config.IsValid", "model.config.is_valid.saml_idp_cert.app_error", nil, "", http.StatusBadRequest) } - if len(*s.EmailAttribute) == 0 { + if *s.EmailAttribute == "" { return NewAppError("Config.IsValid", "model.config.is_valid.saml_email_attribute.app_error", nil, "", http.StatusBadRequest) } - if len(*s.UsernameAttribute) == 0 { + if *s.UsernameAttribute == "" { return NewAppError("Config.IsValid", "model.config.is_valid.saml_username_attribute.app_error", nil, "", http.StatusBadRequest) } - if len(*s.ServiceProviderIdentifier) == 0 { + if *s.ServiceProviderIdentifier == "" { return NewAppError("Config.IsValid", "model.config.is_valid.saml_spidentifier_attribute.app_error", nil, "", http.StatusBadRequest) } if *s.Verify { - if len(*s.AssertionConsumerServiceURL) == 0 || !IsValidHttpUrl(*s.AssertionConsumerServiceURL) { + if *s.AssertionConsumerServiceURL == "" || !IsValidHttpUrl(*s.AssertionConsumerServiceURL) { return NewAppError("Config.IsValid", "model.config.is_valid.saml_assertion_consumer_service_url.app_error", nil, "", http.StatusBadRequest) } } if *s.Encrypt { - if len(*s.PrivateKeyFile) == 0 { + if *s.PrivateKeyFile == "" { return NewAppError("Config.IsValid", "model.config.is_valid.saml_private_key.app_error", nil, "", http.StatusBadRequest) } - if len(*s.PublicCertificateFile) == 0 { + if *s.PublicCertificateFile == "" { return NewAppError("Config.IsValid", "model.config.is_valid.saml_public_cert.app_error", nil, "", http.StatusBadRequest) } } - if len(*s.EmailAttribute) == 0 { + if *s.EmailAttribute == "" { return NewAppError("Config.IsValid", "model.config.is_valid.saml_email_attribute.app_error", nil, "", http.StatusBadRequest) } @@ -3343,7 +3584,7 @@ func (s *SamlSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.saml_canonical_algorithm.app_error", nil, "", http.StatusBadRequest) } - if len(*s.GuestAttribute) > 0 { + if *s.GuestAttribute != "" { if !(strings.Contains(*s.GuestAttribute, "=")) { return NewAppError("Config.IsValid", "model.config.is_valid.saml_guest_attribute.app_error", nil, "", http.StatusBadRequest) } @@ -3352,7 +3593,7 @@ func (s *SamlSettings) isValid() *AppError { } } - if len(*s.AdminAttribute) > 0 { + if *s.AdminAttribute != "" { if !(strings.Contains(*s.AdminAttribute, "=")) { return NewAppError("Config.IsValid", "model.config.is_valid.saml_admin_attribute.app_error", nil, "", http.StatusBadRequest) } @@ -3371,7 +3612,7 @@ func (s *ServiceSettings) isValid() *AppError { } if *s.ConnectionSecurity == CONN_SECURITY_TLS && !*s.UseLetsEncrypt { - appErr := NewAppError("Config.IsValid", "model.config.is_valid.tls_cert_file.app_error", nil, "", http.StatusBadRequest) + appErr := NewAppError("Config.IsValid", "model.config.is_valid.tls_cert_file_missing.app_error", nil, "", http.StatusBadRequest) if *s.TLSCertFile == "" { return appErr @@ -3379,7 +3620,7 @@ func (s *ServiceSettings) isValid() *AppError { return appErr } - appErr = NewAppError("Config.IsValid", "model.config.is_valid.tls_key_file.app_error", nil, "", http.StatusBadRequest) + appErr = NewAppError("Config.IsValid", "model.config.is_valid.tls_key_file_missing.app_error", nil, "", http.StatusBadRequest) if *s.TLSKeyFile == "" { return appErr @@ -3412,13 +3653,13 @@ func (s *ServiceSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.login_attempts.app_error", nil, "", http.StatusBadRequest) } - if len(*s.SiteURL) != 0 { + if *s.SiteURL != "" { if _, err := url.ParseRequestURI(*s.SiteURL); err != nil { return NewAppError("Config.IsValid", "model.config.is_valid.site_url.app_error", nil, "", http.StatusBadRequest) } } - if len(*s.WebsocketURL) != 0 { + if *s.WebsocketURL != "" { if _, err := url.ParseRequestURI(*s.WebsocketURL); err != nil { return NewAppError("Config.IsValid", "model.config.is_valid.websocket_url.app_error", nil, "", http.StatusBadRequest) } @@ -3442,12 +3683,22 @@ func (s *ServiceSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.group_unread_channels.app_error", nil, "", http.StatusBadRequest) } + if *s.CollapsedThreads != COLLAPSED_THREADS_DISABLED && !*s.ThreadAutoFollow { + return NewAppError("Config.IsValid", "model.config.is_valid.collapsed_threads.autofollow.app_error", nil, "", http.StatusBadRequest) + } + + if *s.CollapsedThreads != COLLAPSED_THREADS_DISABLED && + *s.CollapsedThreads != COLLAPSED_THREADS_DEFAULT_ON && + *s.CollapsedThreads != COLLAPSED_THREADS_DEFAULT_OFF { + return NewAppError("Config.IsValid", "model.config.is_valid.collapsed_threads.app_error", nil, "", http.StatusBadRequest) + } + return nil } func (s *ElasticsearchSettings) isValid() *AppError { if *s.EnableIndexing { - if len(*s.ConnectionUrl) == 0 { + if *s.ConnectionUrl == "" { return NewAppError("Config.IsValid", "model.config.is_valid.elastic_search.connection_url.app_error", nil, "", http.StatusBadRequest) } } @@ -3485,7 +3736,7 @@ func (s *ElasticsearchSettings) isValid() *AppError { func (bs *BleveSettings) isValid() *AppError { if *bs.EnableIndexing { - if len(*bs.IndexDir) == 0 { + if *bs.IndexDir == "" { return NewAppError("Config.IsValid", "model.config.is_valid.bleve_search.filename.app_error", nil, "", http.StatusBadRequest) } } else { @@ -3520,7 +3771,7 @@ func (s *DataRetentionSettings) isValid() *AppError { } func (s *LocalizationSettings) isValid() *AppError { - if len(*s.AvailableLocales) > 0 { + if *s.AvailableLocales != "" { if !strings.Contains(*s.AvailableLocales, *s.DefaultClientLocale) { return NewAppError("Config.IsValid", "model.config.is_valid.localization.available_locales.app_error", nil, "", http.StatusBadRequest) } @@ -3529,7 +3780,7 @@ func (s *LocalizationSettings) isValid() *AppError { return nil } -func (s *MessageExportSettings) isValid(fs FileSettings) *AppError { +func (s *MessageExportSettings) isValid() *AppError { if s.EnableExport == nil { return NewAppError("Config.IsValid", "model.config.is_valid.message_export.enable.app_error", nil, "", http.StatusBadRequest) } @@ -3615,32 +3866,36 @@ func (o *Config) GetSanitizeOptions() map[string]bool { } func (o *Config) Sanitize() { - if o.LdapSettings.BindPassword != nil && len(*o.LdapSettings.BindPassword) > 0 { + if o.LdapSettings.BindPassword != nil && *o.LdapSettings.BindPassword != "" { *o.LdapSettings.BindPassword = FAKE_SETTING } *o.FileSettings.PublicLinkSalt = FAKE_SETTING - if len(*o.FileSettings.AmazonS3SecretAccessKey) > 0 { + if *o.FileSettings.AmazonS3SecretAccessKey != "" { *o.FileSettings.AmazonS3SecretAccessKey = FAKE_SETTING } - if o.EmailSettings.SMTPPassword != nil && len(*o.EmailSettings.SMTPPassword) > 0 { + if o.EmailSettings.SMTPPassword != nil && *o.EmailSettings.SMTPPassword != "" { *o.EmailSettings.SMTPPassword = FAKE_SETTING } - if len(*o.GitLabSettings.Secret) > 0 { + if *o.GitLabSettings.Secret != "" { *o.GitLabSettings.Secret = FAKE_SETTING } - if o.GoogleSettings.Secret != nil && len(*o.GoogleSettings.Secret) > 0 { + if o.GoogleSettings.Secret != nil && *o.GoogleSettings.Secret != "" { *o.GoogleSettings.Secret = FAKE_SETTING } - if o.Office365Settings.Secret != nil && len(*o.Office365Settings.Secret) > 0 { + if o.Office365Settings.Secret != nil && *o.Office365Settings.Secret != "" { *o.Office365Settings.Secret = FAKE_SETTING } + if o.OpenIdSettings.Secret != nil && *o.OpenIdSettings.Secret != "" { + *o.OpenIdSettings.Secret = FAKE_SETTING + } + *o.SqlSettings.DataSource = FAKE_SETTING *o.SqlSettings.AtRestEncryptKey = FAKE_SETTING @@ -3654,11 +3909,11 @@ func (o *Config) Sanitize() { o.SqlSettings.DataSourceSearchReplicas[i] = FAKE_SETTING } - if o.MessageExportSettings.GlobalRelaySettings.SmtpPassword != nil && len(*o.MessageExportSettings.GlobalRelaySettings.SmtpPassword) > 0 { + if o.MessageExportSettings.GlobalRelaySettings.SmtpPassword != nil && *o.MessageExportSettings.GlobalRelaySettings.SmtpPassword != "" { *o.MessageExportSettings.GlobalRelaySettings.SmtpPassword = FAKE_SETTING } - if o.ServiceSettings.GfycatApiSecret != nil && len(*o.ServiceSettings.GfycatApiSecret) > 0 { + if o.ServiceSettings.GfycatApiSecret != nil && *o.ServiceSettings.GfycatApiSecret != "" { *o.ServiceSettings.GfycatApiSecret = FAKE_SETTING } @@ -3670,7 +3925,7 @@ func (o *Config) Sanitize() { func structToMapFilteredByTag(t interface{}, typeOfTag, filterTag string) map[string]interface{} { defer func() { if r := recover(); r != nil { - mlog.Error("Panicked in structToMapFilteredByTag. This should never happen.", mlog.Any("recover", r)) + mlog.Warn("Panicked in structToMapFilteredByTag. This should never happen.", mlog.Any("recover", r)) } }() |