diff --git a/node/settings.js b/node/settings.js index 7cee8b6f..81abd3b0 100644 --- a/node/settings.js +++ b/node/settings.js @@ -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); } diff --git a/settings.json b/settings.json index 9ba17de6..c8b2b327 100644 --- a/settings.json +++ b/settings.json @@ -1,7 +1,23 @@ +/* +This file must be valid JSON. But comments are allowed +*/ { "port" : 9001, + + //The Type of the database. You can choose between sqlite and mysql "dbType" : "sqlite", + //the database specific settings "dbSettings" : { "filename" : "../var/sqlite.db" } + + /* An Example of MySQL Configuration + "dbType" : "mysql", + "dbSettings" : { + "user" : "root", + "host" : "localhost", + "password": "", + "database": "store" + } + */ }