pad.libre-service.eu-etherpad/tests/backend/loadSettings.js

20 lines
543 B
JavaScript
Raw Normal View History

2015-06-29 12:00:00 +02:00
var jsonminify = require(__dirname+"/../../src/node_modules/jsonminify");
const fs = require('fs');
2015-06-29 12:00:00 +02:00
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;
2015-06-29 12:00:00 +02:00
}
}catch(e){
console.error("whoops something is bad with settings");
}
}
exports.loadSettings = loadSettings;