mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
closed #1552
This commit is contained in:
@@ -98,6 +98,7 @@ module.exports = function(err, config, databases, callback) {
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
process.stdout.write('\n');
|
||||
winston.info('Now configuring ' + config.database + ' database:');
|
||||
success(err, config, next);
|
||||
},
|
||||
|
||||
@@ -28,8 +28,8 @@ var install = {},
|
||||
questions.main = [
|
||||
{
|
||||
name: 'base_url',
|
||||
description: 'URL of this installation',
|
||||
'default': nconf.get('base_url') || 'http://localhost',
|
||||
description: 'URL used to access this NodeBB',
|
||||
'default': nconf.get('base_url') || 'http://localhost:4567',
|
||||
pattern: /^http(?:s)?:\/\//,
|
||||
message: 'Base URL must begin with \'http://\' or \'https://\'',
|
||||
},
|
||||
@@ -40,13 +40,6 @@ questions.main = [
|
||||
pattern: /[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]/,
|
||||
message: 'Please enter a value betweeen 1 and 65535'
|
||||
},
|
||||
{
|
||||
name: 'use_port',
|
||||
description: 'Use a port number to access NodeBB?',
|
||||
'default': (nconf.get('use_port') !== undefined ? (nconf.get('use_port') ? 'y' : 'n') : 'y'),
|
||||
pattern: /y[es]*|n[o]?/,
|
||||
message: 'Please enter \'yes\' or \'no\''
|
||||
},
|
||||
{
|
||||
name: 'secret',
|
||||
description: 'Please enter a NodeBB secret',
|
||||
@@ -195,16 +188,13 @@ function completeConfigSetup(err, config, next) {
|
||||
|
||||
config.bcrypt_rounds = 12;
|
||||
config.upload_path = '/public/uploads';
|
||||
config.use_port = typeof config.use_port === 'boolean' ? config.use_port : config.use_port.slice(0, 1) === 'y';
|
||||
|
||||
var urlObject = url.parse(config.base_url),
|
||||
relative_path = (urlObject.pathname && urlObject.pathname.length > 1) ? urlObject.pathname : '',
|
||||
host = urlObject.host,
|
||||
protocol = urlObject.protocol,
|
||||
server_conf = config;
|
||||
|
||||
server_conf.base_url = protocol + '//' + host;
|
||||
server_conf.relative_path = relative_path;
|
||||
server_conf.base_url = urlObject.protocol + '//' + urlObject.host;
|
||||
server_conf.use_port = urlObject.port !== null ? true : false;
|
||||
server_conf.relative_path = (urlObject.pathname && urlObject.pathname.length > 1) ? urlObject.pathname : '';
|
||||
|
||||
install.save(server_conf, function(err) {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user