mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 17:36:14 -04:00
Allow comments in the settings file
This commit is contained in:
parent
9849e81e08
commit
b0a937d8de
2 changed files with 21 additions and 3 deletions
|
@ -22,7 +22,10 @@ exports.dbType = "sqlite";
|
|||
exports.dbSettings = { "filename" : "../var/sqlite.db" };
|
||||
|
||||
//read the settings sync
|
||||
var settingsStr = fs.readFileSync("../settings.json");
|
||||
var settingsStr = fs.readFileSync("../settings.json").toString();
|
||||
|
||||
//remove all comments
|
||||
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,"");
|
||||
|
||||
//try to parse the settings
|
||||
var settings;
|
||||
|
@ -33,8 +36,7 @@ try
|
|||
catch(e)
|
||||
{
|
||||
console.error("There is a syntax error in your settings.json file");
|
||||
console.error("We recommend http://jsonlint.com/ to find the mistake");
|
||||
console.error(e.stack);
|
||||
console.error(e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue