summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-12-10 08:54:12 -0500
committerChristopher Speller <crspeller@gmail.com>2015-12-10 08:54:12 -0500
commitaef16866066c8fec2529e57a9659fd3cb03acc91 (patch)
treee92ccc3cb3335238bf9b7fd376dea71454e4a1fc /model/config.go
parent415276fa6a1af933a8b9b8f71afa81e36d9e0b13 (diff)
parent7299fd6a4c6a658b378e4df12468d302ff6a7512 (diff)
downloadchat-aef16866066c8fec2529e57a9659fd3cb03acc91.tar.gz
chat-aef16866066c8fec2529e57a9659fd3cb03acc91.tar.bz2
chat-aef16866066c8fec2529e57a9659fd3cb03acc91.zip
Merge pull request #1688 from mattermost/fix-salts
Generate salts when empty
Diffstat (limited to 'model/config.go')
-rw-r--r--model/config.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go
index 14ce444c5..a3ba812b0 100644
--- a/model/config.go
+++ b/model/config.go
@@ -164,6 +164,23 @@ func ConfigFromJson(data io.Reader) *Config {
}
func (o *Config) SetDefaults() {
+
+ if len(o.SqlSettings.AtRestEncryptKey) == 0 {
+ o.SqlSettings.AtRestEncryptKey = NewRandomString(32)
+ }
+
+ if len(o.FileSettings.PublicLinkSalt) == 0 {
+ o.FileSettings.PublicLinkSalt = NewRandomString(32)
+ }
+
+ if len(o.EmailSettings.InviteSalt) == 0 {
+ o.EmailSettings.InviteSalt = NewRandomString(32)
+ }
+
+ if len(o.EmailSettings.PasswordResetSalt) == 0 {
+ o.EmailSettings.PasswordResetSalt = NewRandomString(32)
+ }
+
if o.ServiceSettings.EnableSecurityFixAlert == nil {
o.ServiceSettings.EnableSecurityFixAlert = new(bool)
*o.ServiceSettings.EnableSecurityFixAlert = true