mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-28 18:23:35 +00:00
added ability to change configs without restart
This commit is contained in:
parent
ac18f7143b
commit
21f0abedf4
3 changed files with 190 additions and 193 deletions
13
cloudcmd.js
13
cloudcmd.js
|
|
@ -179,8 +179,7 @@
|
|||
}
|
||||
|
||||
function readConfig(pCallBack){
|
||||
var lConfPath = JSONDIR + 'config.json',
|
||||
lReaded;
|
||||
var lConfPath = JSONDIR + 'config.json';
|
||||
|
||||
fs.readFile(lConfPath, function(pError, pData){
|
||||
if(!pError){
|
||||
|
|
@ -197,14 +196,10 @@
|
|||
|
||||
if(!Config)
|
||||
fs.watch(lConfPath, function(){
|
||||
if(!lReaded){
|
||||
lReaded = true;
|
||||
readConfig();
|
||||
}
|
||||
|
||||
/* every catch up - calling twice */
|
||||
setTimeout(function() {
|
||||
lReaded = false;
|
||||
}, 10000);
|
||||
readConfig();
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue