diff --git a/app.js b/app.js index 4ce28da224..7a222b930c 100644 --- a/app.js +++ b/app.js @@ -28,7 +28,6 @@ if (require.main !== module) { var nconf = require('nconf'); nconf.argv().env({ separator: '__', - lowerCase: true, }); var url = require('url'); diff --git a/loader.js b/loader.js index f2a511336b..a2df1b33b7 100644 --- a/loader.js +++ b/loader.js @@ -142,7 +142,7 @@ function getPorts() { process.exit(); } var urlObject = url.parse(_url); - var port = nconf.get('port') || urlObject.port || 4567; + var port = nconf.get('PORT') || nconf.get('port') || urlObject.port || 4567; if (!Array.isArray(port)) { port = [port]; } diff --git a/src/start.js b/src/start.js index 0fbdcb4ae8..259dff26bb 100644 --- a/src/start.js +++ b/src/start.js @@ -98,7 +98,8 @@ function setupConfigs() { nconf.set('secure', urlObject.protocol === 'https:'); nconf.set('use_port', !!urlObject.port); nconf.set('relative_path', relativePath); - nconf.set('port', urlObject.port || nconf.get('port') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567); + console.log(nconf.get('port')); + nconf.set('port', nconf.get('PORT') || nconf.get('port') || urlObject.port || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567); nconf.set('upload_url', '/assets/uploads'); } diff --git a/src/webserver.js b/src/webserver.js index 2564642ade..bfc472b8ea 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -252,7 +252,7 @@ function setupAutoLocale(app, callback) { function listen(callback) { callback = callback || function () { }; - var port = parseInt(nconf.get('port'), 10); + var port = nconf.get('port'); var isSocket = isNaN(port); var socketPath = isSocket ? nconf.get('port') : ''; @@ -270,7 +270,7 @@ function listen(callback) { process.exit(); } } - + port = parseInt(port, 10); if ((port !== 80 && port !== 443) || nconf.get('trust_proxy') === true) { winston.info('Enabling \'trust proxy\''); app.enable('trust proxy');