2019-12-03 23:14:00 +01:00
|
|
|
/*
|
|
|
|
* ACHTUNG: there is a copied & modified version of this file in
|
|
|
|
* <basedir>/tests/container/loadSettings.js
|
|
|
|
*
|
|
|
|
* TODO: unify those two files, and merge in a single one.
|
|
|
|
*/
|
|
|
|
|
2015-06-29 12:00:00 +02:00
|
|
|
var jsonminify = require(__dirname+"/../../src/node_modules/jsonminify");
|
2019-12-24 23:40:56 +01:00
|
|
|
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(",}","}");
|
2019-12-24 23:40:56 +01:00
|
|
|
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;
|