Update configuration save / restore for docker
parent
335d2598ec
commit
330c6b751a
|
|
@ -84,7 +84,7 @@ elif [ ! -e "./conf.json" ]; then
|
|||
cp conf.sample.json conf.json
|
||||
fi
|
||||
sudo sed -i -e 's/change_this_to_something_very_random__just_anything_other_than_this/'"$cronKey"'/g' conf.json
|
||||
# node tools/modifyConfiguration.js cpuUsageMarker=CPU subscriptionId=$SUBSCRIPTION_ID thisIsDocker=true pluginKeys="$PLUGIN_KEYS" db="$DATABASE_CONFIG" ssl="$SSL_CONFIG"
|
||||
node tools/modifyConfiguration.js cpuUsageMarker=CPU subscriptionId=$SUBSCRIPTION_ID thisIsDocker=true pluginKeys="$PLUGIN_KEYS" db="$DATABASE_CONFIG" ssl="$SSL_CONFIG"
|
||||
|
||||
|
||||
echo "============="
|
||||
|
|
|
|||
|
|
@ -23,26 +23,23 @@ module.exports = (config) => {
|
|||
return response
|
||||
},
|
||||
getConfiguration: () => {
|
||||
return new Promise((resolve,reject) => {
|
||||
fs.readFile(s.location.config,'utf8',function(err,data){
|
||||
return new Promise((resolve, reject) => {
|
||||
const configPath = config.thisIsDocker ? "/config/conf.json" : s.location.config;
|
||||
|
||||
fs.readFile(configPath, 'utf8', (err,data) => {
|
||||
resolve(JSON.parse(data))
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
},
|
||||
modifyConfiguration: (postBody) => {
|
||||
return new Promise((resolve,reject) => {
|
||||
try{
|
||||
if(config.thisIsDocker){
|
||||
const dockerConfigFile = '/config/conf.json'
|
||||
fs.writeFileSync(dockerConfigFile,JSON.stringify(postBody,null,3))
|
||||
}
|
||||
}catch(err){
|
||||
console.log(err)
|
||||
}
|
||||
fs.writeFile(s.location.config,JSON.stringify(postBody,null,3),function(err){
|
||||
resolve(err)
|
||||
})
|
||||
})
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log(s.location.config)
|
||||
|
||||
const configPath = config.thisIsDocker ? "/config/conf.json" : s.location.config;
|
||||
const configData = JSON.stringify(postBody,null,3);
|
||||
console.log(postBody)
|
||||
fs.writeFile(configPath, configData, resolve);
|
||||
});
|
||||
},
|
||||
updateSystem: () => {
|
||||
return new Promise((resolve,reject) => {
|
||||
|
|
|
|||
|
|
@ -250,17 +250,12 @@ module.exports = function(s,config,lang,app){
|
|||
currentSuperUserList.push(currentSuperUser)
|
||||
}
|
||||
//update master list in system
|
||||
try{
|
||||
if(config.thisIsDocker){
|
||||
const dockerSuperFile = '/config/super.json'
|
||||
fs.writeFileSync(dockerSuperFile,JSON.stringify(currentSuperUserList,null,3))
|
||||
}
|
||||
}catch(err){
|
||||
console.log(err)
|
||||
}
|
||||
fs.writeFile(s.location.super,JSON.stringify(currentSuperUserList,null,3),function(){
|
||||
const configPath = config.thisIsDocker ? "/config/super.json" : s.location.super;
|
||||
const configData = JSON.stringify(postBody,null,3);
|
||||
fs.writeFile(configPath, configData, () => {
|
||||
s.tx({f:'save_preferences'},'$')
|
||||
})
|
||||
});
|
||||
|
||||
}else{
|
||||
endData.ok = false
|
||||
endData.msg = lang.postDataBroken
|
||||
|
|
|
|||
|
|
@ -56,16 +56,10 @@ processArgv.forEach(function(val) {
|
|||
console.log(index + ': ' + value);
|
||||
});
|
||||
|
||||
try{
|
||||
if(config.thisIsDocker){
|
||||
const dockerConfigFile = '/config/conf.json'
|
||||
fs.writeFileSync(dockerConfigFile,JSON.stringify(config,null,3))
|
||||
}
|
||||
}catch(err){
|
||||
console.log(err)
|
||||
}
|
||||
const configPath = config.thisIsDocker ? "/config/conf.json" : configLocation;
|
||||
const configData = JSON.stringify(config,null,3);
|
||||
|
||||
fs.writeFile(configLocation,JSON.stringify(config,null,3),function(){
|
||||
fs.writeFile(configPath, configData, () =>{
|
||||
console.log('Changes Complete. Here is what it is now.')
|
||||
console.log(JSON.stringify(config,null,2))
|
||||
})
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue