summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
authorThomas Balthazar <tbalthazar@users.noreply.github.com>2016-05-24 15:07:42 +0200
committerHarrison Healey <harrisonmhealey@gmail.com>2016-05-24 09:07:42 -0400
commit7e2b539de484ac4f2e97eafce6b8d63ffa2caf13 (patch)
treee85b742e695c611958f249a4e39d0e6370c1f9b0 /model/config.go
parent8e5c31859012516afcfc28eddbb644a4c96fe9d3 (diff)
downloadchat-7e2b539de484ac4f2e97eafce6b8d63ffa2caf13.tar.gz
chat-7e2b539de484ac4f2e97eafce6b8d63ffa2caf13.tar.bz2
chat-7e2b539de484ac4f2e97eafce6b8d63ffa2caf13.zip
Max_File_Size setting in System Console > File Settings (#3070)
Diffstat (limited to 'model/config.go')
-rw-r--r--model/config.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go
index ecfd18710..08b00b90f 100644
--- a/model/config.go
+++ b/model/config.go
@@ -92,6 +92,7 @@ type LogSettings struct {
}
type FileSettings struct {
+ MaxFileSize *int64
DriverName string
Directory string
EnablePublicLink bool
@@ -263,6 +264,11 @@ func (o *Config) SetDefaults() {
o.SqlSettings.AtRestEncryptKey = NewRandomString(32)
}
+ if o.FileSettings.MaxFileSize == nil {
+ o.FileSettings.MaxFileSize = new(int64)
+ *o.FileSettings.MaxFileSize = 52428800 // 50 MB
+ }
+
if len(o.FileSettings.PublicLinkSalt) == 0 {
o.FileSettings.PublicLinkSalt = NewRandomString(32)
}
@@ -569,6 +575,10 @@ func (o *Config) IsValid() *AppError {
return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_max_conn.app_error", nil, "")
}
+ if *o.FileSettings.MaxFileSize <= 0 {
+ return NewLocAppError("Config.IsValid", "model.config.is_valid.max_file_size.app_error", nil, "")
+ }
+
if !(o.FileSettings.DriverName == IMAGE_DRIVER_LOCAL || o.FileSettings.DriverName == IMAGE_DRIVER_S3) {
return NewLocAppError("Config.IsValid", "model.config.is_valid.file_driver.app_error", nil, "")
}