mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
reverting attempt
This commit is contained in:
@@ -40,10 +40,6 @@ var async = require('async'),
|
|||||||
name: 'database',
|
name: 'database',
|
||||||
description: 'Which database to use',
|
description: 'Which database to use',
|
||||||
'default': nconf.get('database') || 'redis'
|
'default': nconf.get('database') || 'redis'
|
||||||
}, {
|
|
||||||
name: 'secondary_database',
|
|
||||||
description: 'Secondary database (optional)',
|
|
||||||
'default': nconf.get('secondary_database') || 'none'
|
|
||||||
}],
|
}],
|
||||||
redisQuestions : [{
|
redisQuestions : [{
|
||||||
name: 'redis:host',
|
name: 'redis:host',
|
||||||
@@ -103,18 +99,10 @@ var async = require('async'),
|
|||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
winston.error('Required values are missing for automated setup:');
|
winston.error('Required values are missing for automated setup:');
|
||||||
if (!setupVal['admin:username']) {
|
if (!setupVal['admin:username']) winston.error(' admin:username');
|
||||||
winston.error(' admin:username');
|
if (!setupVal['admin:password']) winston.error(' admin:password');
|
||||||
}
|
if (!setupVal['admin:password:confirm']) winston.error(' admin:password:confirm');
|
||||||
if (!setupVal['admin:password']) {
|
if (!setupVal['admin:email']) winston.error(' admin:email');
|
||||||
winston.error(' admin:password');
|
|
||||||
}
|
|
||||||
if (!setupVal['admin:password:confirm']) {
|
|
||||||
winston.error(' admin:password:confirm');
|
|
||||||
}
|
|
||||||
if (!setupVal['admin:email']) {
|
|
||||||
winston.error(' admin:email');
|
|
||||||
}
|
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -136,15 +124,9 @@ var async = require('async'),
|
|||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
winston.error('Required values are missing for automated CI integration:');
|
winston.error('Required values are missing for automated CI integration:');
|
||||||
if (!ciVals.hasOwnProperty('host')) {
|
if (!ciVals.hasOwnProperty('host')) winston.error(' host');
|
||||||
winston.error(' host');
|
if (!ciVals.hasOwnProperty('port')) winston.error(' port');
|
||||||
}
|
if (!ciVals.hasOwnProperty('database')) winston.error(' database');
|
||||||
if (!ciVals.hasOwnProperty('port')) {
|
|
||||||
winston.error(' port');
|
|
||||||
}
|
|
||||||
if (!ciVals.hasOwnProperty('database')) {
|
|
||||||
winston.error(' database');
|
|
||||||
}
|
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -190,7 +172,7 @@ var async = require('async'),
|
|||||||
return next(new Error('unknown database : ' + config.database));
|
return next(new Error('unknown database : ' + config.database));
|
||||||
}
|
}
|
||||||
|
|
||||||
var allQuestions = install.redisQuestions.concat(install.mongoQuestions.concat(install.levelQuestions));
|
var allQuestions = install.redisQuestions.concat(install.mongoQuestions);
|
||||||
for(var x=0;x<allQuestions.length;x++) {
|
for(var x=0;x<allQuestions.length;x++) {
|
||||||
delete config[allQuestions[x].name];
|
delete config[allQuestions[x].name];
|
||||||
}
|
}
|
||||||
@@ -212,52 +194,41 @@ var async = require('async'),
|
|||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.secondary_database !== 'none') {
|
|
||||||
require('./database').init(function(err) {
|
|
||||||
askDatabaseQuestions(config.secondary_database);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
require('./database').init(next);
|
require('./database').init(next);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add CI object
|
// Add CI object
|
||||||
if (install.ciVals) {
|
if (install.ciVals) {
|
||||||
config.test_database = {};
|
config['test_database'] = {};
|
||||||
for(var prop in install.ciVals) {
|
for(var prop in install.ciVals) {
|
||||||
if (install.ciVals.hasOwnProperty(prop)) {
|
if (install.ciVals.hasOwnProperty(prop)) {
|
||||||
config.test_database[prop] = install.ciVals[prop];
|
config['test_database'][prop] = install.ciVals[prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function askDatabaseQuestions(database) {
|
if(config.database === 'redis') {
|
||||||
if(database === 'redis') {
|
|
||||||
if (config['redis:host'] && config['redis:port']) {
|
if (config['redis:host'] && config['redis:port']) {
|
||||||
dbQuestionsSuccess(null, config);
|
dbQuestionsSuccess(null, config);
|
||||||
} else {
|
} else {
|
||||||
prompt.get(install.redisQuestions, dbQuestionsSuccess);
|
prompt.get(install.redisQuestions, dbQuestionsSuccess);
|
||||||
}
|
}
|
||||||
} else if(database === 'mongo') {
|
} else if(config.database === 'mongo') {
|
||||||
if (config['mongo:host'] && config['mongo:port']) {
|
if (config['mongo:host'] && config['mongo:port']) {
|
||||||
dbQuestionsSuccess(null, config);
|
dbQuestionsSuccess(null, config);
|
||||||
} else {
|
} else {
|
||||||
prompt.get(install.mongoQuestions, dbQuestionsSuccess);
|
prompt.get(install.mongoQuestions, dbQuestionsSuccess);
|
||||||
}
|
}
|
||||||
} else if(database === 'level') {
|
} else if(config.database === 'level') {
|
||||||
if (config['level:database']) {
|
if (config['level:database']) {
|
||||||
dbQuestionsSuccess(null, config);
|
dbQuestionsSuccess(null, config);
|
||||||
} else {
|
} else {
|
||||||
prompt.get(install.levelQuestions, dbQuestionsSuccess);
|
prompt.get(install.levelQuestions, dbQuestionsSuccess);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return next(new Error('unknown database : ' + database));
|
return next(new Error('unknown database : ' + config.database));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
askDatabaseQuestions(config.database);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// prompt prepends "prompt: " to questions, let's clear that.
|
// prompt prepends "prompt: " to questions, let's clear that.
|
||||||
|
|||||||
Reference in New Issue
Block a user