Skip to content

Node.js based forum software built for the modern web

update url from config file even if it was passed in env

barisusakli29b0552466d2
diff --git a/loader.js b/loader.js
index df528871e9..fa8945e48c 100644
--- a/loader.js
+++ b/loader.js
@@ -151,9 +151,25 @@ function getPorts() {
Loader.restart = function () {
killWorkers();
+
+ var pathToConfig = path.join(__dirname, '/config.json');
nconf.remove('file');
- nconf.use('file', { file: path.join(__dirname, '/config.json') });
- Loader.start();
+ nconf.use('file', { file: pathToConfig });
+
+ fs.readFile(pathToConfig, {encoding: 'utf-8'}, function(err, configFile) {
+ if (err) {
+ console.log('Error reading config : ' + err.message);
+ process.exit();
+ }
+
+ var conf = JSON.parse(configFile);
+
+ nconf.stores.env.readOnly = false;
+ nconf.set('url', conf.url);
+ nconf.stores.env.readOnly = true;
+
+ Loader.start();
+ });
};
Loader.reload = function () {