mirror of
https://github.com/strapi/strapi.git
synced 2025-12-26 14:44:31 +00:00
Merge pull request #610 from strapi/fix-db-args
Fix strapi new without db args
This commit is contained in:
commit
21441e41d2
@ -29,6 +29,7 @@ const logger = require('strapi-utils').logger;
|
||||
module.exports = (scope, cb) => {
|
||||
// App info.
|
||||
const hasDatabaseConfig = !!scope.database;
|
||||
|
||||
_.defaults(scope, {
|
||||
name: scope.name === '.' || !scope.name ? scope.name : path.basename(process.cwd()),
|
||||
author: process.env.USER || 'A Strapi developer',
|
||||
@ -116,7 +117,6 @@ module.exports = (scope, cb) => {
|
||||
}
|
||||
])
|
||||
.then(answers => {
|
||||
|
||||
if (hasDatabaseConfig) {
|
||||
const databaseChoice = _.find(databaseChoices, ['value.database', scope.database.settings.client]);
|
||||
scope.database.connector = databaseChoice.value.connector;
|
||||
|
||||
@ -42,7 +42,15 @@ module.exports = function (name, cliArguments) {
|
||||
developerMode
|
||||
};
|
||||
|
||||
if (_.values(_.omit(cliArguments, ['dev'])).length) {
|
||||
const dbArguments = ['dbclient', 'dbhost', 'dbport', 'dbname', 'dbusername', 'dbpassword'];
|
||||
const matchingDbArguments = _.intersection(_.keys(cliArguments), dbArguments);
|
||||
|
||||
if (matchingDbArguments.length) {
|
||||
if (matchingDbArguments.length !== dbArguments.length) {
|
||||
logger.warn(`Some database arguments are missing. Required arguments list: ${dbArguments}`);
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
scope.database = {
|
||||
settings: {
|
||||
client: cliArguments.dbclient,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user