v1.18.x
Barış Soner Uşaklı 7 years ago
parent adbdf69a49
commit 2aaf6900d1

@ -28,7 +28,6 @@ if (require.main !== module) {
var nconf = require('nconf');
nconf.argv().env({
separator: '__',
lowerCase: true,
});
var url = require('url');

@ -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];
}

@ -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');
}

@ -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');

Loading…
Cancel
Save