pass error messages to pad text if shown during startup
parent
b26956be4b
commit
3a969f8dd8
|
@ -54,6 +54,9 @@
|
|||
//the default text of a pad
|
||||
"defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n",
|
||||
|
||||
/* Shoud we suppress errors from being visible in the default Pad Text? */
|
||||
"suppressErrorsInPadText" : false,
|
||||
|
||||
/* Users must have a session to access pads. This effectively allows only group pads to be accessed. */
|
||||
"requireSession" : false,
|
||||
|
||||
|
|
|
@ -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, ".."));
|
||||
|
@ -54,6 +54,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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue