diff options
author | John McLear <john@mclear.co.uk> | 2015-04-07 21:24:47 +0100 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2015-04-07 21:24:47 +0100 |
commit | a2e6a1bb4f2035716df4195c40382c3fc991535a (patch) | |
tree | 24a07ed17b1c64ca08f3a61b630a11223ec40c9d /src | |
parent | a5aa58e28bb9fcd5d645898077a77086a13145eb (diff) | |
parent | 3a969f8dd83062c0537d3e7e0eb005bb5a669ef7 (diff) | |
download | etherpad-lite-a2e6a1bb4f2035716df4195c40382c3fc991535a.zip |
Merge pull request #2579 from ether/warnings-in-pad-contents
pass error messages to pad text if shown during startup
Diffstat (limited to 'src')
-rw-r--r-- | src/node/utils/Settings.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 5382d819..888e86d3 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -27,7 +27,7 @@ var npm = require("npm/lib/npm.js"); var jsonminify = require("jsonminify"); var log4js = require("log4js"); var randomString = require("./randomstring"); - +var suppressDisableMsg = " -- To suppress these warning messages change suppressErrorsInPadText to true in your settings.json\n"; /* Root path of the installation */ exports.root = path.normalize(path.join(npm.dir, "..")); @@ -55,6 +55,11 @@ exports.ip = "0.0.0.0"; exports.port = process.env.PORT || 9001; /** + * Should we suppress Error messages from being in Pad Contents + */ +exports.suppressErrorsInPadText = false; + +/** * The SSL signed server key and the Certificate Authority's own certificate * default case: ep-lite does *not* use SSL. A signed server key is not required in this case. */ @@ -266,7 +271,11 @@ exports.reloadSettings = function reloadSettings() { { fs.exists(exports.abiword, function(exists) { if (!exists) { - console.error("Abiword does not exist at this path, check your settings file"); + var abiwordError = "Abiword does not exist at this path, check your settings file"; + if(!exports.suppressErrorsInPadText){ + exports.defaultPadText = exports.defaultPadText + "\nError: " + abiwordError + suppressDisableMsg; + } + console.error(abiwordError); exports.abiword = null; } }); @@ -275,11 +284,19 @@ 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); - console.warn("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"); + 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; + } + console.warn(sessionWarning); } if(exports.dbType === "dirty"){ - console.warn("DirtyDB is used. This is fine for testing but not recommended for production."); + var dirtyWarning = "DirtyDB is used. This is fine for testing but not recommended for production."; + if(!exports.suppressErrorsInPadText){ + exports.defaultPadText = exports.defaultPadText + "\nWarning: " + dirtyWarning + suppressDisableMsg; + } + console.warn(dirtyWarning); } }; |