etherpad-lite/tests/backend/loadSettings.js
muxator fe0cf4bdb0 tests: reorganize some files, because we are going to copy & paste them.
In the following commits Pierre is going to copy & modify some files.
This commit prepares the source files in order to minimize those differences,
so we can re-unify them as soon as possible.

No functional changes.
2019-12-25 00:28:38 +01:00

19 lines
543 B
JavaScript

var jsonminify = require(__dirname+"/../../src/node_modules/jsonminify");
const fs = require('fs');
function loadSettings(){
var settingsStr = fs.readFileSync(__dirname+"/../../settings.json").toString();
// try to parse the settings
try {
if(settingsStr) {
settingsStr = jsonminify(settingsStr).replace(",]","]").replace(",}","}");
var settings = JSON.parse(settingsStr);
return settings;
}
}catch(e){
console.error("whoops something is bad with settings");
}
}
exports.loadSettings = loadSettings;