summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
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, "")
}