v1.18.x
Julian Lam 10 years ago
parent 8af5102912
commit b565f3ac0a

@ -99,18 +99,26 @@ if(nconf.get('ssl')) {
module.exports.listen = function(callback) { module.exports.listen = function(callback) {
logger.init(app); logger.init(app);
var bind_address = ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')) + ':' + port; var isSocket = isNaN(port),
args = isSocket ? [port] : [port, nconf.get('bind_address')],
bind_address = ((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(err) { // Alter umask if necessary
if (isSocket) {
process.umask('0000');
}
args.push(function(err) {
if (err) { if (err) {
winston.info('NodeBB was unable to listen on: ' + bind_address); winston.info('NodeBB was unable to listen on: ' + bind_address);
return callback(err); return callback(err);
} }
winston.info('NodeBB is now listening on: ' + bind_address); winston.info('NodeBB is now listening on: ' + (isSocket ? port : bind_address));
callback(); callback();
}); });
server.listen.apply(server, args);
}; };
}(WebServer)); }(WebServer));

Loading…
Cancel
Save