From 348e931a20ea676d9a464256e6ad851440d5101a Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 28 Sep 2015 07:55:59 -0400 Subject: Updating dockerfiles and version.go --- model/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model') diff --git a/model/version.go b/model/version.go index 8f0c76ebe..233fc3747 100644 --- a/model/version.go +++ b/model/version.go @@ -12,7 +12,7 @@ import ( // It should be maitained in chronological order with most current // release at the front of the list. var versions = []string{ - "0.8.0", + "1.0.0", "0.7.1", "0.7.0", "0.6.0", -- cgit v1.2.3-1-g7c22 From ce74afd9edc8bc1aec7cd168e7d7388c1f0bf67e Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 28 Sep 2015 08:05:40 -0400 Subject: Fixing version unit test --- model/version_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model') diff --git a/model/version_test.go b/model/version_test.go index da40006be..24dbedaa6 100644 --- a/model/version_test.go +++ b/model/version_test.go @@ -36,7 +36,7 @@ func TestSplitVersion(t *testing.T) { } func TestGetPreviousVersion(t *testing.T) { - if major, minor := GetPreviousVersion("0.8.0"); major != 0 || minor != 7 { + if major, minor := GetPreviousVersion("1.0.0"); major != 0 || minor != 7 { t.Fatal(major, minor) } -- cgit v1.2.3-1-g7c22 From 8fadea44debd00c1babd12bff9eb2dd0a5d99370 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 29 Sep 2015 14:17:16 -0700 Subject: PLT-404 adding basic error checking to config file. --- model/config.go | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'model') diff --git a/model/config.go b/model/config.go index 853e2bbc0..5d822e263 100644 --- a/model/config.go +++ b/model/config.go @@ -16,6 +16,9 @@ const ( IMAGE_DRIVER_LOCAL = "local" IMAGE_DRIVER_S3 = "amazons3" + DATABASE_DRIVER_MYSQL = "mysql" + DATABASE_DRIVER_POSTGRES = "postgres" + SERVICE_GITLAB = "gitlab" ) @@ -156,3 +159,92 @@ func ConfigFromJson(data io.Reader) *Config { return nil } } + +func (o *Config) IsValid() *AppError { + + if o.ServiceSettings.MaximumLoginAttempts <= 0 { + return NewAppError("Config.IsValid", "Invalid maximum login attempts for service settings. Must be a positive number.", "") + } + + if len(o.ServiceSettings.ListenAddress) == 0 { + return NewAppError("Config.IsValid", "Invalid listen address for service settings Must be set.", "") + } + + if o.TeamSettings.MaxUsersPerTeam <= 0 { + return NewAppError("Config.IsValid", "Invalid maximum users per team for team settings. Must be a positive number.", "") + } + + if len(o.SqlSettings.AtRestEncryptKey) != 32 { + return NewAppError("Config.IsValid", "Invalid at rest encrypt key for SQL settings. Must be 32 chars.", "") + } + + if !(o.SqlSettings.DriverName == DATABASE_DRIVER_MYSQL || o.SqlSettings.DriverName == DATABASE_DRIVER_POSTGRES) { + return NewAppError("Config.IsValid", "Invalid driver name for SQL settings. Must be 'mysql' or 'postgres'", "") + } + + if o.SqlSettings.MaxIdleConns <= 0 { + return NewAppError("Config.IsValid", "Invalid maximum idle connection for SQL settings. Must be a positive number.", "") + } + + if len(o.SqlSettings.DataSource) == 0 { + return NewAppError("Config.IsValid", "Invalid data source for SQL settings. Must be set.", "") + } + + if o.SqlSettings.MaxOpenConns <= 0 { + return NewAppError("Config.IsValid", "Invalid maximum open connection for SQL settings. Must be a positive number.", "") + } + + if !(o.FileSettings.DriverName == IMAGE_DRIVER_LOCAL || o.FileSettings.DriverName == IMAGE_DRIVER_S3) { + return NewAppError("Config.IsValid", "Invalid driver name for file settings. Must be 'local' or 'amazons3'", "") + } + + if o.FileSettings.PreviewHeight < 0 { + return NewAppError("Config.IsValid", "Invalid preview height for file settings. Must be a zero or positive number.", "") + } + + if o.FileSettings.PreviewWidth <= 0 { + return NewAppError("Config.IsValid", "Invalid preview width for file settings. Must be a positive number.", "") + } + + if o.FileSettings.ProfileHeight <= 0 { + return NewAppError("Config.IsValid", "Invalid profile height for file settings. Must be a positive number.", "") + } + + if o.FileSettings.ProfileWidth <= 0 { + return NewAppError("Config.IsValid", "Invalid profile width for file settings. Must be a positive number.", "") + } + + if o.FileSettings.ThumbnailHeight <= 0 { + return NewAppError("Config.IsValid", "Invalid thumbnail height for file settings. Must be a positive number.", "") + } + + if o.FileSettings.ThumbnailHeight <= 0 { + return NewAppError("Config.IsValid", "Invalid thumbnail width for file settings. Must be a positive number.", "") + } + + if len(o.FileSettings.PublicLinkSalt) != 32 { + return NewAppError("Config.IsValid", "Invalid public link salt for file settings. Must be 32 chars.", "") + } + + if !(o.EmailSettings.ConnectionSecurity == CONN_SECURITY_NONE || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_TLS || o.EmailSettings.ConnectionSecurity == CONN_SECURITY_STARTTLS) { + return NewAppError("Config.IsValid", "Invalid connection security for email settings. Must be '', 'TLS', or 'STARTTLS'", "") + } + + if len(o.EmailSettings.InviteSalt) != 32 { + return NewAppError("Config.IsValid", "Invalid invite salt for email settings. Must be 32 chars.", "") + } + + if len(o.EmailSettings.PasswordResetSalt) != 32 { + return NewAppError("Config.IsValid", "Invalid password reset salt for email settings. Must be 32 chars.", "") + } + + if o.RateLimitSettings.MemoryStoreSize <= 0 { + return NewAppError("Config.IsValid", "Invalid memory store size for rate limit settings. Must be a positive number", "") + } + + if o.RateLimitSettings.PerSec <= 0 { + return NewAppError("Config.IsValid", "Invalid per sec for rate limit settings. Must be a positive number", "") + } + + return nil +} -- cgit v1.2.3-1-g7c22