mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 07:24:52 +09:00
#59 interface for editing config + more docs
This commit is contained in:
1 parent
906b192683
commit
8146a313f3
3 files changed
+65
-6
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user