mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-01 03:28:16 +02:00
update url from config file even if it was passed in env
This commit is contained in:
20
loader.js
20
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 () {
|
||||
|
||||
Reference in New Issue
Block a user