From 53d4721ece8ecc6b0bb31de9fcd46774e845da05 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 23 Feb 2013 04:19:16 -0500 Subject: [PATCH] added ability to change configs without restart (works for js minification only) --- ChangeLog | 3 ++- cloudcmd.js | 14 +++++++++----- lib/server.js | 5 ----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 553da0c0..2c45d9f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -166,7 +166,8 @@ for now it's much simplier. * Fixed the first show of menu in firefox. -* Added ability to change configs without restart. +* Added ability to change configs without restart +(works for js minification only). 2012.12.12, Version 0.1.8 diff --git a/cloudcmd.js b/cloudcmd.js index 308e5b75..13dd67ff 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -19,7 +19,7 @@ server = main.librequire('server'), Minify = main.minify, - Config, + Config = main.config, REQUEST = 'request', RESPONSE = 'response', @@ -160,7 +160,7 @@ process.chdir(lServerDir); } Util.log('server dir: ' + lServerDir); - Util.log('reading configuretion file config.json...'); + Util.log('reading configuration file config.json...'); if(Config){ Util.log('config.json readed'); @@ -191,11 +191,15 @@ if(!pError){ Util.log('config: readed'); - var lStr = pData.toString(); - main.config = Config = JSON.parse(lStr); + var lStr = pData.toString(), + lReadedConf = Util.parseJSON(lStr); + + if(!Config.minification) + main.config = Config = lReadedConf; Util.tryCatchLog(function(){ - Minify.setAllowed(main.config.minification); + Config.minification.js = lReadedConf.minification.js; + Minify.setAllowed(Config.minification); }); } else diff --git a/lib/server.js b/lib/server.js index 446415c0..d81d41f5 100644 --- a/lib/server.js +++ b/lib/server.js @@ -57,11 +57,6 @@ if(!pProcessing) pProcessing = {}; - - else - Util.log('warning: configuretion file config.json not found...\n' + - 'using default values...\n' + - JSON.stringify(lConfig)); Rest = pProcessing.rest; Route = pProcessing.route;