#59 interface for editing config + more docs

This commit is contained in:
Danielv123 committed 2017-11-11 23:51:52 +01:00
1 parent 906b192683
commit 8146a313f3
3 files changed
+65 -6

No files matched your search

+15 -1
View File
@@ -6,7 +6,8 @@ Provides tools for managing both masters and slaves config files.
const asTable = require("as-table").configure({delimiter: ' | '});
// internal requires
const config = require("./../../config");
var config = require("./../../config");
const objectOps = require("./../objectOps.js");
/**
console.log()s each entry in the config
@@ -25,3 +26,16 @@ module.exports.displayConfig = function(instance){
console.log(asTable(configArray));
}
}
module.exports.editConfig = function(instance, entry, newValue){
if(!instance || instance == "shared"){
if(config[entry] && newValue){
if(objectOps.isJSON(newValue)){
console.log("Changing config entry "+entry+" from "+JSON.stringify(config[entry])+" to "+JSON.stringify(newValue));
config[entry] = JSON.parse(newValue);
} else {
console.log("Changing config entry "+entry+" from "+config[entry]+" to '"+newValue+"'");
config[entry] = newValue;
}
}
}
};