mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 07:55:46 +01:00
automatically lowercasing env vars in nconf, fixes #2544
This commit is contained in:
5
app.js
5
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');
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
@@ -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') : '';
|
||||
|
||||
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user