mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
Reworked startup sequence to respect server.listen() failures and timings.
This commit is contained in:
3
app.js
3
app.js
@@ -84,8 +84,7 @@ function start() {
|
|||||||
nconf.set('base_dir', __dirname);
|
nconf.set('base_dir', __dirname);
|
||||||
|
|
||||||
winston.info('Time: ' + new Date());
|
winston.info('Time: ' + new Date());
|
||||||
winston.info('Initializing NodeBB v' + pkg.version + ', on port ' + nconf.get('port') + ', using ' + nconf.get('database') +' store at ' + nconf.get(nconf.get('database') + ':host') + ':' + nconf.get(nconf.get('database') + ':port') + '.');
|
winston.info('Initializing NodeBB v' + pkg.version + ', using ' + nconf./**/get('database') +' store at ' + nconf.get(nconf.get('database') + ':host') + ':' + nconf.get(nconf.get('database') + ':port') + '.');
|
||||||
winston.info('NodeBB instance bound to: ' + ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '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.');
|
||||||
|
|||||||
@@ -415,8 +415,20 @@ module.exports.server = server;
|
|||||||
templates.logout = parsedTemplate;
|
templates.logout = parsedTemplate;
|
||||||
});
|
});
|
||||||
|
|
||||||
winston.info('NodeBB Ready');
|
server.on("error", function(e){
|
||||||
server.listen(nconf.get('PORT') || nconf.get('port'), nconf.get('bind_address'));
|
if (e.code === 'EADDRINUSE') {
|
||||||
|
winston.error('NodeBB address in use, exiting...');
|
||||||
|
process.exit(1);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var port = nconf.get('PORT') || nconf.get('port');
|
||||||
|
winston.info('NodeBB attempting to listen on: ' + ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')) + ':' + port);
|
||||||
|
server.listen(port, nconf.get('bind_address'), function(){
|
||||||
|
winston.info('NodeBB Ready');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
app.create_route = function (url, tpl) { // to remove
|
app.create_route = function (url, tpl) { // to remove
|
||||||
|
|||||||
Reference in New Issue
Block a user