mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
closed #1552
This commit is contained in:
@@ -91,13 +91,14 @@ function getSecondaryDatabaseModules(config, next) {
|
|||||||
|
|
||||||
module.exports = function(err, config, databases, callback) {
|
module.exports = function(err, config, databases, callback) {
|
||||||
var allowedDBs = Object.keys(databases);
|
var allowedDBs = Object.keys(databases);
|
||||||
|
|
||||||
allowedDBs.forEach(function(db) {
|
allowedDBs.forEach(function(db) {
|
||||||
questions[db] = require('./../src/database/' + db).questions;
|
questions[db] = require('./../src/database/' + db).questions;
|
||||||
});
|
});
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
|
process.stdout.write('\n');
|
||||||
winston.info('Now configuring ' + config.database + ' database:');
|
winston.info('Now configuring ' + config.database + ' database:');
|
||||||
success(err, config, next);
|
success(err, config, next);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ var install = {},
|
|||||||
questions.main = [
|
questions.main = [
|
||||||
{
|
{
|
||||||
name: 'base_url',
|
name: 'base_url',
|
||||||
description: 'URL of this installation',
|
description: 'URL used to access this NodeBB',
|
||||||
'default': nconf.get('base_url') || 'http://localhost',
|
'default': nconf.get('base_url') || 'http://localhost:4567',
|
||||||
pattern: /^http(?:s)?:\/\//,
|
pattern: /^http(?:s)?:\/\//,
|
||||||
message: 'Base URL must begin with \'http://\' or \'https://\'',
|
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]/,
|
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'
|
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',
|
name: 'secret',
|
||||||
description: 'Please enter a NodeBB secret',
|
description: 'Please enter a NodeBB secret',
|
||||||
@@ -195,16 +188,13 @@ function completeConfigSetup(err, config, next) {
|
|||||||
|
|
||||||
config.bcrypt_rounds = 12;
|
config.bcrypt_rounds = 12;
|
||||||
config.upload_path = '/public/uploads';
|
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),
|
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 = config;
|
||||||
|
|
||||||
server_conf.base_url = protocol + '//' + host;
|
server_conf.base_url = urlObject.protocol + '//' + urlObject.host;
|
||||||
server_conf.relative_path = relative_path;
|
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) {
|
install.save(server_conf, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -243,7 +233,7 @@ function setupDefaultConfigs(next) {
|
|||||||
winston.info('Populating database with default configs, if not already set...');
|
winston.info('Populating database with default configs, if not already set...');
|
||||||
var meta = require('./meta'),
|
var meta = require('./meta'),
|
||||||
defaults = require(path.join(__dirname, '../', 'install/data/defaults.json'));
|
defaults = require(path.join(__dirname, '../', 'install/data/defaults.json'));
|
||||||
|
|
||||||
async.each(defaults, function (configObj, next) {
|
async.each(defaults, function (configObj, next) {
|
||||||
meta.configs.setOnEmpty(configObj.field, configObj.value, next);
|
meta.configs.setOnEmpty(configObj.field, configObj.value, next);
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user