summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/config.go4
-rw-r--r--model/config_test.go17
2 files changed, 21 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go
index 303d7bb75..0c3307a06 100644
--- a/model/config.go
+++ b/model/config.go
@@ -487,6 +487,10 @@ func (o *Config) SetDefaults() {
o.FileSettings.InitialFont = "luximbi.ttf"
}
+ if o.FileSettings.Directory == "" {
+ o.FileSettings.Directory = "./data/"
+ }
+
if len(o.EmailSettings.InviteSalt) == 0 {
o.EmailSettings.InviteSalt = NewRandomString(32)
}
diff --git a/model/config_test.go b/model/config_test.go
new file mode 100644
index 000000000..62a77c133
--- /dev/null
+++ b/model/config_test.go
@@ -0,0 +1,17 @@
+// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package model
+
+import (
+ "testing"
+)
+
+func TestConfigDefaultFileSettingsDirectory(t *testing.T) {
+ c1 := Config{}
+ c1.SetDefaults()
+
+ if c1.FileSettings.Directory != "./data/" {
+ t.Fatal("FileSettings.Directory should default to './data/'")
+ }
+}