diff options
Diffstat (limited to 'model/config.go')
-rw-r--r-- | model/config.go | 82 |
1 files changed, 77 insertions, 5 deletions
diff --git a/model/config.go b/model/config.go index 50a8dc133..9030f91ae 100644 --- a/model/config.go +++ b/model/config.go @@ -96,11 +96,8 @@ type EmailSettings struct { ConnectionSecurity string InviteSalt string PasswordResetSalt string - - // For Future Use - ApplePushServer string - ApplePushCertPublic string - ApplePushCertPrivate string + SendPushNotifications *bool + PushNotificationServer *string } type RateLimitSettings struct { @@ -116,6 +113,15 @@ type PrivacySettings struct { ShowFullName bool } +type SupportSettings struct { + TermsOfServiceLink *string + PrivacyPolicyLink *string + AboutLink *string + HelpLink *string + ReportAProblemLink *string + SupportEmail *string +} + type TeamSettings struct { SiteName string MaxUsersPerTeam int @@ -135,6 +141,7 @@ type Config struct { EmailSettings EmailSettings RateLimitSettings RateLimitSettings PrivacySettings PrivacySettings + SupportSettings SupportSettings GitLabSettings SSOSettings } @@ -167,6 +174,23 @@ func ConfigFromJson(data io.Reader) *Config { } func (o *Config) SetDefaults() { + + if len(o.SqlSettings.AtRestEncryptKey) == 0 { + o.SqlSettings.AtRestEncryptKey = NewRandomString(32) + } + + if len(o.FileSettings.PublicLinkSalt) == 0 { + o.FileSettings.PublicLinkSalt = NewRandomString(32) + } + + if len(o.EmailSettings.InviteSalt) == 0 { + o.EmailSettings.InviteSalt = NewRandomString(32) + } + + if len(o.EmailSettings.PasswordResetSalt) == 0 { + o.EmailSettings.PasswordResetSalt = NewRandomString(32) + } + if o.ServiceSettings.EnableSecurityFixAlert == nil { o.ServiceSettings.EnableSecurityFixAlert = new(bool) *o.ServiceSettings.EnableSecurityFixAlert = true @@ -181,6 +205,46 @@ func (o *Config) SetDefaults() { o.TeamSettings.EnableTeamListing = new(bool) *o.TeamSettings.EnableTeamListing = false } + + if o.EmailSettings.SendPushNotifications == nil { + o.EmailSettings.SendPushNotifications = new(bool) + *o.EmailSettings.SendPushNotifications = false + } + + if o.EmailSettings.PushNotificationServer == nil { + o.EmailSettings.PushNotificationServer = new(string) + *o.EmailSettings.PushNotificationServer = "" + } + + if o.SupportSettings.TermsOfServiceLink == nil { + o.SupportSettings.TermsOfServiceLink = new(string) + *o.SupportSettings.TermsOfServiceLink = "/static/help/terms.html" + } + + if o.SupportSettings.PrivacyPolicyLink == nil { + o.SupportSettings.PrivacyPolicyLink = new(string) + *o.SupportSettings.PrivacyPolicyLink = "/static/help/privacy.html" + } + + if o.SupportSettings.AboutLink == nil { + o.SupportSettings.AboutLink = new(string) + *o.SupportSettings.AboutLink = "/static/help/about.html" + } + + if o.SupportSettings.HelpLink == nil { + o.SupportSettings.HelpLink = new(string) + *o.SupportSettings.HelpLink = "/static/help/help.html" + } + + if o.SupportSettings.ReportAProblemLink == nil { + o.SupportSettings.ReportAProblemLink = new(string) + *o.SupportSettings.ReportAProblemLink = "/static/help/report_problem.html" + } + + if o.SupportSettings.SupportEmail == nil { + o.SupportSettings.SupportEmail = new(string) + *o.SupportSettings.SupportEmail = "feedback@mattermost.com" + } } func (o *Config) IsValid() *AppError { @@ -271,3 +335,11 @@ func (o *Config) IsValid() *AppError { return nil } + +func (me *Config) GetSanitizeOptions() map[string]bool { + options := map[string]bool{} + options["fullname"] = me.PrivacySettings.ShowFullName + options["email"] = me.PrivacySettings.ShowEmailAddress + + return options +} |