PLT-4005 Generates default Salts if empty in the config file (#3950)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
4bd5935bd8
Коммит
886ab34443
@@ -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",
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user