mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
minor changes
This commit is contained in:
parent
d98cb73f69
commit
79f2f34a79
5 changed files with 63 additions and 21 deletions
54
cloudcmd.js
54
cloudcmd.js
|
|
@ -8,6 +8,7 @@
|
|||
SRVDIR = main.SRVDIR,
|
||||
CLIENTDIR = LIBDIR + 'client',
|
||||
HTMLDIR = main.HTMLDIR,
|
||||
JSONDIR = main.JSONDIR,
|
||||
|
||||
path = main.path,
|
||||
fs = main.fs,
|
||||
|
|
@ -18,7 +19,7 @@
|
|||
|
||||
server = main.librequire('server'),
|
||||
Minify = main.minify,
|
||||
Config = main.config,
|
||||
Config,
|
||||
|
||||
REQUEST = 'request',
|
||||
RESPONSE = 'response',
|
||||
|
|
@ -29,16 +30,8 @@
|
|||
* Win32 should be backslashes */
|
||||
DIR = main.DIR;
|
||||
|
||||
readConfig();
|
||||
server.start(Config, {
|
||||
appcache : appCacheProcessing,
|
||||
minimize : minimize,
|
||||
rest : rest,
|
||||
route : route
|
||||
});
|
||||
readConfig(init);
|
||||
|
||||
if(update)
|
||||
update.get();
|
||||
|
||||
/**
|
||||
* additional processing of index file
|
||||
|
|
@ -136,7 +129,16 @@
|
|||
return Util.exec(main.rest, pConnectionData);
|
||||
}
|
||||
|
||||
function readConfig(){
|
||||
function init(){
|
||||
server.start(Config, {
|
||||
appcache : appCacheProcessing,
|
||||
minimize : minimize,
|
||||
rest : rest,
|
||||
route : route
|
||||
});
|
||||
|
||||
if(update)
|
||||
update.get();
|
||||
|
||||
/* Determining server.js directory
|
||||
* and chang current process directory
|
||||
|
|
@ -176,6 +178,36 @@
|
|||
}
|
||||
}
|
||||
|
||||
function readConfig(pCallBack){
|
||||
var lConfPath = JSONDIR + 'config.json',
|
||||
lReaded;
|
||||
|
||||
fs.readFile(lConfPath, function(pError, pData){
|
||||
if(!pError){
|
||||
Util.log('config: readed');
|
||||
var lStr = pData.toString();
|
||||
Util.log( lStr );
|
||||
main.config = Config = JSON.parse(lStr);
|
||||
}
|
||||
else
|
||||
Util.log(pError);
|
||||
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
|
||||
if(!Config)
|
||||
fs.watch(lConfPath, function(){
|
||||
if(!lReaded){
|
||||
lReaded = true;
|
||||
readConfig();
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
lReaded = false;
|
||||
}, 10000);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* routing of server queries
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue