mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
Update app.js
Only check if file exists when no other supported --arguments are given. Display that 0.0.0.0 is Any Address. Moved upgrade section to after install section. added CLI --help!
This commit is contained in:
35
app.js
35
app.js
@@ -55,7 +55,7 @@
|
|||||||
winston.info('');
|
winston.info('');
|
||||||
|
|
||||||
|
|
||||||
if (fs.existsSync(__dirname + '/config.json') && (!nconf.get('setup') && !nconf.get('upgrade'))) {
|
if (!nconf.get('help') && !nconf.get('setup') && !nconf.get('upgrade') && fs.existsSync(__dirname + '/config.json')) {
|
||||||
// Load server-side configs
|
// Load server-side configs
|
||||||
nconf.file({
|
nconf.file({
|
||||||
file: __dirname + '/config.json'
|
file: __dirname + '/config.json'
|
||||||
@@ -66,6 +66,7 @@
|
|||||||
nconf.set('upload_url', nconf.get('url') + 'uploads/');
|
nconf.set('upload_url', nconf.get('url') + 'uploads/');
|
||||||
|
|
||||||
winston.info('Initializing NodeBB v' + pkg.version + ', on port ' + nconf.get('port') + ', using Redis store at ' + nconf.get('redis:host') + ':' + nconf.get('redis:port') + '.');
|
winston.info('Initializing NodeBB v' + pkg.version + ', on port ' + nconf.get('port') + ', using Redis store at ' + nconf.get('redis:host') + ':' + nconf.get('redis:port') + '.');
|
||||||
|
winston.info('NodeBB instance bound to: ' + (nconf.get('bind_address') === "0.0.0.0" ? 'Any address (0.0.0.0)' : nconf.get('bind_address')));
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
winston.info('Base Configuration OK.');
|
winston.info('Base Configuration OK.');
|
||||||
@@ -85,6 +86,7 @@
|
|||||||
webserver = require('./src/webserver.js'),
|
webserver = require('./src/webserver.js'),
|
||||||
SocketIO = require('socket.io').listen(global.server, { log: false, transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket']}),
|
SocketIO = require('socket.io').listen(global.server, { log: false, transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket']}),
|
||||||
websockets = require('./src/websockets.js'),
|
websockets = require('./src/websockets.js'),
|
||||||
|
posts = require('./src/posts.js'),
|
||||||
plugins = require('./src/plugins'); // Don't remove this - plugins initializes itself
|
plugins = require('./src/plugins'); // Don't remove this - plugins initializes itself
|
||||||
|
|
||||||
websockets.init(SocketIO);
|
websockets.init(SocketIO);
|
||||||
@@ -106,13 +108,7 @@
|
|||||||
templates.ready(webserver.init);
|
templates.ready(webserver.init);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (nconf.get('upgrade')) {
|
} else if (nconf.get('setup') || !fs.existsSync(__dirname + '/config.json')) {
|
||||||
meta = require('./src/meta.js');
|
|
||||||
|
|
||||||
meta.configs.init(function () {
|
|
||||||
require('./src/upgrade').upgrade();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// New install, ask setup questions
|
// New install, ask setup questions
|
||||||
if (nconf.get('setup')) {
|
if (nconf.get('setup')) {
|
||||||
winston.info('NodeBB Setup Triggered via Command Line');
|
winston.info('NodeBB Setup Triggered via Command Line');
|
||||||
@@ -130,10 +126,29 @@
|
|||||||
if (err) {
|
if (err) {
|
||||||
winston.error('There was a problem completing NodeBB setup: ', err.message);
|
winston.error('There was a problem completing NodeBB setup: ', err.message);
|
||||||
} else {
|
} else {
|
||||||
winston.info('NodeBB Setup Completed.');
|
winston.info('NodeBB Setup Completed. Run \'node app\' to manually start your NodeBB server.');
|
||||||
}
|
}
|
||||||
|
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
} else if (nconf.get('upgrade')) {
|
||||||
|
nconf.file({
|
||||||
|
file: __dirname + '/config.json'
|
||||||
|
});
|
||||||
|
meta = require('./src/meta.js');
|
||||||
|
|
||||||
|
meta.configs.init(function () {
|
||||||
|
require('./src/upgrade').upgrade();
|
||||||
|
});
|
||||||
|
} else/* if (nconf.get('help') */{
|
||||||
|
winston.info('Usage: node app [options] [arguments]');
|
||||||
|
winston.info(' [NODE_ENV=development | NODE_ENV=production] node app [--start] [arguments]');
|
||||||
|
winston.info('');
|
||||||
|
winston.info('Options:');
|
||||||
|
winston.info(' --help displays this usage information');
|
||||||
|
winston.info(' --setup configure your environment and setup NodeBB');
|
||||||
|
winston.info(' --upgrade upgrade NodeBB, first read: github.com/designcreateplay/NodeBB/wiki/Upgrading-NodeBB');
|
||||||
|
winston.info(' --start manually start NodeBB (default when no options are given)');
|
||||||
|
};
|
||||||
}());
|
}());
|
||||||
Reference in New Issue
Block a user