have the server parse the settings file using minify and strip commas
This commit is contained in:
parent
7550be0921
commit
9b7203d4d2
|
@ -24,7 +24,7 @@ var os = require("os");
|
|||
var path = require('path');
|
||||
var argv = require('./Cli').argv;
|
||||
var npm = require("npm/lib/npm.js");
|
||||
var vm = require('vm');
|
||||
var jsonminify = require("jsonminify");
|
||||
var log4js = require("log4js");
|
||||
var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;
|
||||
|
||||
|
@ -166,8 +166,8 @@ exports.reloadSettings = function reloadSettings() {
|
|||
var settings;
|
||||
try {
|
||||
if(settingsStr) {
|
||||
settings = vm.runInContext('exports = '+settingsStr, vm.createContext(), "settings.json");
|
||||
settings = JSON.parse(JSON.stringify(settings)); // fix objects having constructors of other vm.context
|
||||
settingsStr = jsonminify(settingsStr).replace(",]","]").replace(",}","}");
|
||||
settings = JSON.parse(settingsStr);
|
||||
}
|
||||
}catch(e){
|
||||
console.error('There was an error processing your settings.json file: '+e.message);
|
||||
|
|
Loading…
Reference in New Issue