summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-12-09 15:42:48 -0800
committer=Corey Hulen <corey@hulen.com>2015-12-09 15:42:48 -0800
commit9fbe16c17b6b435d0737e15be2d06fddd76798cc (patch)
treecb46cde227454e23fdb3be9b4f83552820f5ab93 /model/config.go
parent84aa572f67cc41d59690a73f080d0f6c81be4ae0 (diff)
downloadchat-9fbe16c17b6b435d0737e15be2d06fddd76798cc.tar.gz
chat-9fbe16c17b6b435d0737e15be2d06fddd76798cc.tar.bz2
chat-9fbe16c17b6b435d0737e15be2d06fddd76798cc.zip
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