Skip to content

Node.js based forum software built for the modern web

warning/errors on invalid ports config

barisusakli0d6772c30b4a
diff --git a/src/webserver.js b/src/webserver.js
index 8671209113..da998cae06 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -33,6 +33,21 @@ if(nconf.get('ssl')) {
(function (app) {
var port = nconf.get('port');
+ if (Array.isArray(port)) {
+ if (!port.length) {
+ winston.error('[startup] empty ports array in config.json');
+ process.exit();
+ }
+
+ winston.warn('[startup] If you want to start nodebb on multiple ports please use loader.js');
+ winston.warn('[startup] Defaulting to first port in array, ' + port[0]);
+ port = port[0];
+ if (!port) {
+ winston.error('[startup] Invalid port, exiting');
+ process.exit();
+ }
+ }
+
module.exports.init = function() {
var skipJS, skipLess, fromFile = nconf.get('from-file') || '';
@@ -164,6 +179,10 @@ if(nconf.get('ssl')) {
};
module.exports.testSocket = function(socketPath, callback) {
+ if (typeof socketPath !== 'string') {
+ return callback(new Error('invalid socket path : ' + socketPath));
+ }
+
async.series([
function(next) {
fs.exists(socketPath, function(exists) {