From 5e15f8683e74e41a6b03b03245a5abcc377738b6 Mon Sep 17 00:00:00 2001 From: RefinedSoftwareLLC Date: Sat, 26 Oct 2013 10:56:05 -0600 Subject: [PATCH] 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! --- app.js | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 7a6f68dc7a..5a0bdcdaba 100644 --- a/app.js +++ b/app.js @@ -55,7 +55,7 @@ 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 nconf.file({ file: __dirname + '/config.json' @@ -66,6 +66,7 @@ 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('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') { winston.info('Base Configuration OK.'); @@ -85,6 +86,7 @@ webserver = require('./src/webserver.js'), SocketIO = require('socket.io').listen(global.server, { log: false, transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket']}), websockets = require('./src/websockets.js'), + posts = require('./src/posts.js'), plugins = require('./src/plugins'); // Don't remove this - plugins initializes itself websockets.init(SocketIO); @@ -105,14 +107,8 @@ templates.ready(webserver.init); }); - - } else if (nconf.get('upgrade')) { - meta = require('./src/meta.js'); - - meta.configs.init(function () { - require('./src/upgrade').upgrade(); - }); - } else { + + } else if (nconf.get('setup') || !fs.existsSync(__dirname + '/config.json')) { // New install, ask setup questions if (nconf.get('setup')) { winston.info('NodeBB Setup Triggered via Command Line'); @@ -130,10 +126,29 @@ if (err) { winston.error('There was a problem completing NodeBB setup: ', err.message); } else { - winston.info('NodeBB Setup Completed.'); + winston.info('NodeBB Setup Completed. Run \'node app\' to manually start your NodeBB server.'); } process.exit(); }); - } -}()); \ No newline at end of file + + } 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)'); + }; +}());