diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-12-08 13:38:43 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-12-16 17:30:15 -0500 |
commit | 58358ddd7cd0152bf16a7326e1d595524fb51246 (patch) | |
tree | 350cd462f9b530529e0f098fa1d458c3a36abd4a /model/config.go | |
parent | 4f881046bf2a4c74fb44d71e2e78826c70719a8c (diff) | |
download | chat-58358ddd7cd0152bf16a7326e1d595524fb51246.tar.gz chat-58358ddd7cd0152bf16a7326e1d595524fb51246.tar.bz2 chat-58358ddd7cd0152bf16a7326e1d595524fb51246.zip |
Some refactoring
Diffstat (limited to 'model/config.go')
-rw-r--r-- | model/config.go | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/model/config.go b/model/config.go index 06cb9829e..38ef81a85 100644 --- a/model/config.go +++ b/model/config.go @@ -20,6 +20,7 @@ const ( DATABASE_DRIVER_POSTGRES = "postgres" SERVICE_GITLAB = "gitlab" + SERVICE_GOOGLE = "google" ) type ServiceSettings struct { @@ -133,6 +134,26 @@ type TeamSettings struct { EnableTeamListing *bool } +type LdapSettings struct { + // Basic + Enable *bool + LdapServer *string + LdapPort *int + BaseDN *string + BindUsername *string + BindPassword *string + + // User Mapping + FirstNameAttribute *string + LastNameAttribute *string + EmailAttribute *string + UsernameAttribute *string + IdAttribute *string + + // Advansed + QueryTimeout *int +} + type Config struct { ServiceSettings ServiceSettings TeamSettings TeamSettings @@ -144,6 +165,8 @@ type Config struct { PrivacySettings PrivacySettings SupportSettings SupportSettings GitLabSettings SSOSettings + GoogleSettings SSOSettings + LdapSettings LdapSettings } func (o *Config) ToJson() string { @@ -156,8 +179,11 @@ func (o *Config) ToJson() string { } func (o *Config) GetSSOService(service string) *SSOSettings { - if service == SERVICE_GITLAB { + switch service { + case SERVICE_GITLAB: return &o.GitLabSettings + case SERVICE_GOOGLE: + return &o.GoogleSettings } return nil @@ -251,6 +277,21 @@ func (o *Config) SetDefaults() { o.SupportSettings.SupportEmail = new(string) *o.SupportSettings.SupportEmail = "feedback@mattermost.com" } + + if o.LdapSettings.LdapPort == nil { + o.LdapSettings.LdapPort = new(int) + *o.LdapSettings.LdapPort = 389 + } + + if o.LdapSettings.QueryTimeout == nil { + o.LdapSettings.QueryTimeout = new(int) + *o.LdapSettings.QueryTimeout = 60 + } + + if o.LdapSettings.Enable == nil { + o.LdapSettings.Enable = new(bool) + *o.LdapSettings.Enable = false + } } func (o *Config) IsValid() *AppError { |