Skip to content

Node.js based forum software built for the modern web

automatically lowercasing env vars in nconf, fixes #2544

Julian Lamd98b3e8056e8
diff --git a/app.js b/app.js
index 90f5ef046e..7a0b7bc2a5 100644
--- a/app.js
+++ b/app.js
@@ -26,7 +26,10 @@ if (require.main !== module) {
}
var nconf = require('nconf');
-nconf.argv().env('__');
+nconf.argv().env({
+ separator: '__',
+ lowerCase: true,
+});
var url = require('url');
var async = require('async');
diff --git a/loader.js b/loader.js
index 214f785eb9..f897fd79ce 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') || nconf.get('PORT') || urlObject.port || 4567;
+ var port = nconf.get('port') || urlObject.port || 4567;
if (!Array.isArray(port)) {
port = [port];
}
diff --git a/package.json b/package.json
index f092c45508..0a0b28dd14 100644
--- a/package.json
+++ b/package.json
@@ -60,7 +60,7 @@
"nodebb-plugin-emoji-extended": "1.1.1",
"nodebb-plugin-emoji-one": "1.2.1",
"nodebb-plugin-markdown": "7.1.1",
- "nodebb-plugin-mentions": "2.0.3",
+ "nodebb-plugin-mentions": "2.1.1",
"nodebb-plugin-soundpack-default": "1.0.0",
"nodebb-plugin-spam-be-gone": "0.5.0",
"nodebb-rewards-essentials": "0.0.9",
diff --git a/src/start.js b/src/start.js
index 8d4e465a55..2195a0ec29 100644
--- a/src/start.js
+++ b/src/start.js
@@ -98,7 +98,7 @@ 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') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567);
+ nconf.set('port', urlObject.port || nconf.get('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 867a2c8826..828aa7b3da 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -231,6 +231,7 @@ function setupAutoLocale(app, callback) {
function listen(callback) {
callback = callback || function () { };
+ console.log('derp', nconf.get('port'));
var port = parseInt(nconf.get('port'), 10);
var isSocket = isNaN(port);
var socketPath = isSocket ? nconf.get('port') : '';
diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js
index 27dab2b647..c43b01a900 100644
--- a/test/mocks/databasemock.js
+++ b/test/mocks/databasemock.js
@@ -110,7 +110,7 @@ before(function (done) {
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') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567);
+ nconf.set('port', urlObject.port || nconf.get('port') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567);
nconf.set('upload_path', path.join(nconf.get('base_dir'), nconf.get('upload_path')));
nconf.set('core_templates_path', path.join(__dirname, '../../src/views'));