Load the settings even when not starting in node path

This commit is contained in:
Azul 2012-01-05 11:24:33 +01:00
parent d73f053b5a
commit 33ffda19b1
1 changed files with 3 additions and 1 deletions

View File

@ -20,6 +20,7 @@
*/ */
var fs = require("fs"); var fs = require("fs");
var path = require('path');
/** /**
* The IP ep-lite should listen to * The IP ep-lite should listen to
@ -74,7 +75,8 @@ exports.loglevel = "INFO";
exports.httpAuth = null; exports.httpAuth = null;
//read the settings sync //read the settings sync
var settingsStr = fs.readFileSync("../settings.json").toString(); var settingsPath = path.normalize(__dirname + "/../../");
var settingsStr = fs.readFileSync(settingsPath + "settings.json").toString();
//remove all comments //remove all comments
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,""); settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,"");