mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
Allow the location/name of settings.json to be passed through an optional --settings arg
This commit is contained in:
parent
9ca914f8cd
commit
7b2388bb56
4 changed files with 21 additions and 9 deletions
|
@ -22,6 +22,7 @@
|
|||
var fs = require("fs");
|
||||
var os = require("os");
|
||||
var path = require('path');
|
||||
var argv = require('optimist').argv;
|
||||
|
||||
/**
|
||||
* The IP ep-lite should listen to
|
||||
|
@ -88,9 +89,12 @@ exports.abiwordAvailable = function()
|
|||
}
|
||||
}
|
||||
|
||||
// Discover where the settings file lives
|
||||
var settingsFilename = argv.settings || "settings.json";
|
||||
var settingsPath = settingsFilename.charAt(0) == '/' ? '' : path.normalize(__dirname + "/../../");
|
||||
|
||||
//read the settings sync
|
||||
var settingsPath = path.normalize(__dirname + "/../../");
|
||||
var settingsStr = fs.readFileSync(settingsPath + "settings.json").toString();
|
||||
var settingsStr = fs.readFileSync(settingsPath + settingsFilename).toString();
|
||||
|
||||
//remove all comments
|
||||
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,"");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue