summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-09-06 09:21:18 -0300
committerJoram Wilander <jwawilander@gmail.com>2016-09-06 08:21:18 -0400
commit886ab34443b25fa8f4d81e954dd8e4bfe6f99511 (patch)
tree404d54866b20140e97fdfcfe87a011a83ed60c9a
parent4bd5935bd825eaa92b9d534d9554b762c38e6250 (diff)
downloadchat-886ab34443b25fa8f4d81e954dd8e4bfe6f99511.tar.gz
chat-886ab34443b25fa8f4d81e954dd8e4bfe6f99511.tar.bz2
chat-886ab34443b25fa8f4d81e954dd8e4bfe6f99511.zip
PLT-4005 Generates default Salts if empty in the config file (#3950)
-rw-r--r--config/config.json8
-rw-r--r--utils/config.go9
2 files changed, 13 insertions, 4 deletions
diff --git a/config/config.json b/config/config.json
index 56ced04b5..9756a356a 100644
--- a/config/config.json
+++ b/config/config.json
@@ -52,7 +52,7 @@
"MaxIdleConns": 10,
"MaxOpenConns": 10,
"Trace": false,
- "AtRestEncryptKey": "7rAh6iwQCkV4cA1Gsg3fgGOXJAQ43QVg"
+ "AtRestEncryptKey": ""
},
"LogSettings": {
"EnableConsole": true,
@@ -75,7 +75,7 @@
"DriverName": "local",
"Directory": "./data/",
"EnablePublicLink": false,
- "PublicLinkSalt": "A705AklYF8MFDOfcwh3I488G8vtLlVip",
+ "PublicLinkSalt": "",
"ThumbnailWidth": 120,
"ThumbnailHeight": 100,
"PreviewWidth": 1024,
@@ -106,8 +106,8 @@
"SMTPServer": "",
"SMTPPort": "",
"ConnectionSecurity": "",
- "InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS",
- "PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL",
+ "InviteSalt": "",
+ "PasswordResetSalt": "",
"SendPushNotifications": false,
"PushNotificationServer": "",
"PushNotificationContents": "generic",
diff --git a/utils/config.go b/utils/config.go
index a42b608b2..f4186d352 100644
--- a/utils/config.go
+++ b/utils/config.go
@@ -165,12 +165,21 @@ func LoadConfig(fileName string) {
CfgFileName = fileName
}
+ needSave := len(config.SqlSettings.AtRestEncryptKey) == 0 || len(*config.FileSettings.PublicLinkSalt) == 0 ||
+ len(config.EmailSettings.InviteSalt) == 0 || len(config.EmailSettings.PasswordResetSalt) == 0
+
config.SetDefaults()
if err := config.IsValid(); err != nil {
panic(T(err.Id))
}
+ if needSave {
+ if err := SaveConfig(fileName, &config); err != nil {
+ l4g.Warn(T(err.Id))
+ }
+ }
+
if err := ValidateLdapFilter(&config); err != nil {
panic(T(err.Id))
}