|
|
@ -40,6 +40,10 @@ 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',
|
|
|
@ -208,7 +212,14 @@ 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);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -222,27 +233,31 @@ var async = require('async'),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(config.database === 'redis') {
|
|
|
|
function askDatabaseQuestions(database) {
|
|
|
|
|
|
|
|
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(config.database === 'mongo') {
|
|
|
|
} else if(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(config.database === 'level') {
|
|
|
|
} else if(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 : ' + config.database));
|
|
|
|
return next(new Error('unknown database : ' + database));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
askDatabaseQuestions(config.database);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// prompt prepends "prompt: " to questions, let's clear that.
|
|
|
|
// prompt prepends "prompt: " to questions, let's clear that.
|
|
|
|