summaryrefslogtreecommitdiff
path: root/src/node/utils
diff options
context:
space:
mode:
authorStefan <mu.stefan@googlemail.com>2015-04-11 18:45:14 +0200
committerStefan <mu.stefan@googlemail.com>2015-04-11 18:45:14 +0200
commita3ed82ad0622aaed0777e63280a2487322c49bad (patch)
tree7b7b0a99bb20d1078090d70437233cae22241b8a /src/node/utils
parent1d44490dc491796836854cf5f3f7aed8bb3af1a0 (diff)
downloadetherpad-lite-a3ed82ad0622aaed0777e63280a2487322c49bad.zip
Move sessionKey setting from settings.json to SESSIONKEY.txt
Diffstat (limited to 'src/node/utils')
-rw-r--r--src/node/utils/Settings.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js
index 7e0e6c5a..bd15a2df 100644
--- a/src/node/utils/Settings.js
+++ b/src/node/utils/Settings.js
@@ -286,13 +286,15 @@ exports.reloadSettings = function reloadSettings() {
}
}
- if(!exports.sessionKey){ // If the secretKey isn't set we also create yet another unique value here
- exports.sessionKey = randomString(32);
- var sessionWarning = "You need to set a sessionKey value in settings.json, this will allow your users to reconnect to your Etherpad Instance if your instance restarts";
- if(!exports.suppressErrorsInPadText){
- exports.defaultPadText = exports.defaultPadText + "\nWarning: " + sessionWarning + suppressDisableMsg;
+ if (!exports.sessionKey) {
+ try {
+ exports.sessionKey = fs.readFileSync("./SESSIONKEY.txt","utf8");
+ } catch(e) {
+ exports.sessionKey = randomString(32);
+ fs.writeFileSync("./SESSIONKEY.txt",exports.sessionKey,"utf8");
}
- console.warn(sessionWarning);
+ } else {
+ console.warn("Declaring the sessionKey in the settings.json is deprecated. This value is auto-generated now. Please remove the setting from the file.");
}
if(exports.dbType === "dirty"){