diff options
Diffstat (limited to 'model/config.go')
-rw-r--r-- | model/config.go | 135 |
1 files changed, 71 insertions, 64 deletions
diff --git a/model/config.go b/model/config.go index 436f063c8..69f2127b2 100644 --- a/model/config.go +++ b/model/config.go @@ -8,27 +8,29 @@ import ( "io" ) +const ( + CONN_SECURITY_NONE = "" + CONN_SECURITY_TLS = "TLS" + CONN_SECURITY_STARTTLS = "STARTTLS" + + IMAGE_DRIVER_LOCAL = "local" + IMAGE_DRIVER_S3 = "amazons3" + + SERVICE_GITLAB = "gitlab" +) + type ServiceSettings struct { - SiteName string - Mode string - AllowTesting bool - UseSSL bool - Port string - Version string - InviteSalt string - PublicLinkSalt string - ResetSalt string - AnalyticsUrl string - UseLocalStorage bool - StorageDirectory string - AllowedLoginAttempts int - DisableEmailSignUp bool + ListenAddress string + MaximumLoginAttempts int + SegmentDeveloperKey string + GoogleDeveloperKey string EnableOAuthServiceProvider bool - AllowIncomingWebhooks bool + EnableIncomingWebhooks bool + EnableTesting bool } -type SSOSetting struct { - Allow bool +type SSOSettings struct { + Enable bool Secret string Id string Scope string @@ -48,87 +50,84 @@ type SqlSettings struct { } type LogSettings struct { - ConsoleEnable bool + EnableConsole bool ConsoleLevel string - FileEnable bool + EnableFile bool FileLevel string FileFormat string FileLocation string } -type AWSSettings struct { - S3AccessKeyId string - S3SecretAccessKey string - S3Bucket string - S3Region string -} - -type ImageSettings struct { - ThumbnailWidth uint - ThumbnailHeight uint - PreviewWidth uint - PreviewHeight uint - ProfileWidth uint - ProfileHeight uint - InitialFont string +type FileSettings struct { + DriverName string + Directory string + EnablePublicLink bool + PublicLinkSalt string + ThumbnailWidth uint + ThumbnailHeight uint + PreviewWidth uint + PreviewHeight uint + ProfileWidth uint + ProfileHeight uint + InitialFont string + AmazonS3AccessKeyId string + AmazonS3SecretAccessKey string + AmazonS3Bucket string + AmazonS3Region string } type EmailSettings struct { - ByPassEmail bool - SMTPUsername string - SMTPPassword string - SMTPServer string - UseTLS bool - UseStartTLS bool - FeedbackEmail string - FeedbackName string + EnableSignUpWithEmail bool + SendEmailNotifications bool + RequireEmailVerification bool + FeedbackName string + FeedbackEmail string + SMTPUsername string + SMTPPassword string + SMTPServer string + SMTPPort string + ConnectionSecurity string + InviteSalt string + PasswordResetSalt string + + // For Future Use ApplePushServer string ApplePushCertPublic string ApplePushCertPrivate string } type RateLimitSettings struct { - UseRateLimiter bool - PerSec int - MemoryStoreSize int - VaryByRemoteAddr bool - VaryByHeader string + EnableRateLimiter bool + PerSec int + MemoryStoreSize int + VaryByRemoteAddr bool + VaryByHeader string } type PrivacySettings struct { ShowEmailAddress bool - ShowPhoneNumber bool - ShowSkypeId bool ShowFullName bool } -type ClientSettings struct { - SegmentDeveloperKey string - GoogleDeveloperKey string -} - type TeamSettings struct { + SiteName string MaxUsersPerTeam int - AllowPublicLink bool - AllowValetDefault bool - TourLink string DefaultThemeColor string - DisableTeamCreation bool + EnableTeamCreation bool + EnableUserCreation bool RestrictCreationToDomains string } type Config struct { - LogSettings LogSettings ServiceSettings ServiceSettings + TeamSettings TeamSettings SqlSettings SqlSettings - AWSSettings AWSSettings - ImageSettings ImageSettings + LogSettings LogSettings + FileSettings FileSettings EmailSettings EmailSettings RateLimitSettings RateLimitSettings PrivacySettings PrivacySettings - ClientSettings ClientSettings - TeamSettings TeamSettings - SSOSettings map[string]SSOSetting + GitLabSettings SSOSettings } func (o *Config) ToJson() string { @@ -140,6 +139,14 @@ func (o *Config) ToJson() string { } } +func (o *Config) GetSSOService(service string) *SSOSettings { + if service == SERVICE_GITLAB { + return &o.GitLabSettings + } + + return nil +} + func ConfigFromJson(data io.Reader) *Config { decoder := json.NewDecoder(data) var o Config |