hide secondary_database option behind "advanced" setup flag

This commit is contained in:
psychobunny
2014-04-14 13:29:21 -04:00
parent ffe9afc3c4
commit d5b5dd6fa5
2 changed files with 56 additions and 24 deletions

View File

@@ -42,10 +42,6 @@ var async = require('async'),
name: 'database',
description: 'Which database to use',
'default': nconf.get('database') || 'redis'
}, {
name: 'secondary_database',
description: 'Use secondary database? (optional)',
'default': nconf.get('secondary_database') || 'none'
}],
redisQuestions : [{
name: 'redis:host',
@@ -244,20 +240,18 @@ var async = require('async'),
if (!install.values) {
prompt.get(install.questions, function(err, config) {
async.waterfall([
function(next) {
winston.info('Now configuring ' + config.database + ' database:');
success(err, config, next);
},
function(config, next) {
winston.info('Now configuring ' + config.secondary_database + ' database:');
if (config.secondary_database && ALLOWED_DATABASES.indexOf(config.secondary_database) !== -1) {
getSecondaryDatabaseModules(config, next);
} else {
next(err, config);
}
}
], completeConfigSetup);
if (nconf.get('advanced')) {
prompt.get({
name: 'secondary_database',
description: 'Select secondary database',
'default': nconf.get('secondary_database') || 'none'
}, function(err, dbConfig) {
config.secondary_database = dbConfig.secondary_database;
configureDatabases(err, config);
});
} else {
configureDatabases(err, config);
}
});
} else {
// Use provided values, fall back to defaults
@@ -282,6 +276,23 @@ var async = require('async'),
});
}
function configureDatabases(err, config) {
async.waterfall([
function(next) {
winston.info('Now configuring ' + config.database + ' database:');
success(err, config, next);
},
function(config, next) {
winston.info('Now configuring ' + config.secondary_database + ' database:');
if (config.secondary_database && ALLOWED_DATABASES.indexOf(config.secondary_database) !== -1) {
getSecondaryDatabaseModules(config, next);
} else {
next(err, config);
}
}
], completeConfigSetup);
}
function completeConfigSetup(err, config) {
config.bcrypt_rounds = 12;
config.upload_path = '/public/uploads';