Remove jsonfile dependency from config editor

install-with-shinobicctv-user-instead-of-root
Moe 2020-08-25 21:35:24 -07:00
parent 3807f371e2
commit c593adc570
1 changed files with 20 additions and 3 deletions

View File

@ -4,8 +4,7 @@ process.on('uncaughtException', function (err) {
});
var configLocation = __dirname+'/../conf.json';
var fs = require('fs');
var jsonfile = require("jsonfile");
var config = jsonfile.readFileSync(configLocation);
var config = JSON.parse(fs.readFileSync(configLocation));
var processArgv = process.argv.splice(2,process.argv.length)
var arguments = {};
@ -57,7 +56,25 @@ processArgv.forEach(function(val) {
console.log(index + ': ' + value);
});
jsonfile.writeFile(configLocation,config,{spaces: 2},function(){
try{
const dockerConfigFile = '/config/conf.json'
fs.stat(dockerConfigFile,(err) => {
if(!err){
fs.stat('../thisIsDocker.txt',(err) => {
if(!err){
fs.writeFile(dockerConfigFile,JSON.stringify(config,null,3),function(){
console.log('Changes Complete. Here is what it is now.')
console.log(JSON.stringify(config,null,2))
})
}
})
}
})
}catch(err){
console.log(err)
}
fs.writeFile(configLocation,JSON.stringify(config,null,3),function(){
console.log('Changes Complete. Here is what it is now.')
console.log(JSON.stringify(config,null,2))
})