mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 11:01:20 +01:00
fix: cant store URL in nconf
This commit is contained in:
@@ -93,7 +93,15 @@ function loadConfig(configFile) {
|
|||||||
const urlObject = new URL(url);
|
const urlObject = new URL(url);
|
||||||
|
|
||||||
nconf.set('url', url.replace(/\/$/, ''));
|
nconf.set('url', url.replace(/\/$/, ''));
|
||||||
nconf.set('url_parsed', urlObject);
|
nconf.set('url_parsed', {
|
||||||
|
href: urlObject.href,
|
||||||
|
origin: urlObject.origin,
|
||||||
|
protocol: urlObject.protocol,
|
||||||
|
host: urlObject.host,
|
||||||
|
hostname: urlObject.hostname,
|
||||||
|
port: urlObject.port,
|
||||||
|
pathname: urlObject.pathname,
|
||||||
|
});
|
||||||
// Parse out the relative_url and other goodies from the configured URL
|
// Parse out the relative_url and other goodies from the configured URL
|
||||||
const relativePath = urlObject.pathname !== '/' ? urlObject.pathname.replace(/\/+$/, '') : '';
|
const relativePath = urlObject.pathname !== '/' ? urlObject.pathname.replace(/\/+$/, '') : '';
|
||||||
nconf.set('base_url', `${urlObject.protocol}//${urlObject.host}`);
|
nconf.set('base_url', `${urlObject.protocol}//${urlObject.host}`);
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ require('../../require-main');
|
|||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const nconf = require('nconf');
|
const nconf = require('nconf');
|
||||||
const url = require('url');
|
|
||||||
const util = require('util');
|
|
||||||
|
|
||||||
process.env.NODE_ENV = process.env.TEST_ENV || 'production';
|
process.env.NODE_ENV = process.env.TEST_ENV || 'production';
|
||||||
|
|
||||||
@@ -52,7 +50,15 @@ nconf.set('relative_path', relativePath);
|
|||||||
nconf.set('asset_base_url', `${relativePath}/assets`);
|
nconf.set('asset_base_url', `${relativePath}/assets`);
|
||||||
nconf.set('upload_path', path.join(nconf.get('base_dir'), nconf.get('upload_path')));
|
nconf.set('upload_path', path.join(nconf.get('base_dir'), nconf.get('upload_path')));
|
||||||
nconf.set('upload_url', '/assets/uploads');
|
nconf.set('upload_url', '/assets/uploads');
|
||||||
nconf.set('url_parsed', urlObject);
|
nconf.set('url_parsed', {
|
||||||
|
href: urlObject.href,
|
||||||
|
origin: urlObject.origin,
|
||||||
|
protocol: urlObject.protocol,
|
||||||
|
host: urlObject.host,
|
||||||
|
hostname: urlObject.hostname,
|
||||||
|
port: urlObject.port,
|
||||||
|
pathname: urlObject.pathname,
|
||||||
|
});
|
||||||
nconf.set('base_url', `${urlObject.protocol}//${urlObject.host}`);
|
nconf.set('base_url', `${urlObject.protocol}//${urlObject.host}`);
|
||||||
nconf.set('secure', urlObject.protocol === 'https:');
|
nconf.set('secure', urlObject.protocol === 'https:');
|
||||||
nconf.set('use_port', !!urlObject.port);
|
nconf.set('use_port', !!urlObject.port);
|
||||||
|
|||||||
Reference in New Issue
Block a user