Skip to content

Node.js based forum software built for the modern web

load config change

Baris Soner Usaklifb1313ec90ff
diff --git a/app.js b/app.js
index 8ad89c8ade..665944644b 100644
--- a/app.js
+++ b/app.js
@@ -82,8 +82,7 @@ if (!nconf.get('help') && !nconf.get('setup') && !nconf.get('install') && !nconf
displayHelp();
};
-
-function start() {
+function loadConfig() {
nconf.file({
file: configFile
});
@@ -92,13 +91,18 @@ function start() {
themes_path: path.join(__dirname, 'node_modules')
});
+ // Ensure themes_path is a full filepath
+ nconf.set('themes_path', path.resolve(__dirname, nconf.get('themes_path')));
+}
+
+
+function start() {
+ loadConfig();
+
nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path'));
nconf.set('upload_url', path.join(path.sep, nconf.get('relative_path'), 'uploads', path.sep));
nconf.set('base_dir', __dirname);
- // Ensure themes_path is a full filepath
- nconf.set('themes_path', path.resolve(__dirname, nconf.get('themes_path')));
-
winston.info('Time: ' + new Date());
winston.info('Initializing NodeBB v' + pkg.version);
winston.info('* using configuration stored in: ' + configFile);
@@ -157,16 +161,14 @@ function start() {
}
function setup() {
+ loadConfig();
+
if (nconf.get('setup')) {
winston.info('NodeBB Setup Triggered via Command Line');
} else {
winston.warn('Configuration not found, starting NodeBB setup');
}
- nconf.file({
- file: __dirname + '/config.json'
- });
-
var install = require('./src/install');
winston.info('Welcome to NodeBB!');
@@ -185,9 +187,7 @@ function setup() {
}
function upgrade() {
- nconf.file({
- file: __dirname + '/config.json'
- });
+ loadConfig();
var meta = require('./src/meta');
@@ -199,9 +199,7 @@ function upgrade() {
}
function reset() {
- nconf.file({
- file: __dirname + '/config.json'
- });
+ loadConfig();
var meta = require('./src/meta'),
db = require('./src/database'),