Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/strapi/node_modules/strapi-generate-new/lib/utils/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
const chalk = require('chalk');
const stopProcess = require('./stop-process');
const DB_ARGS = [
'dbclient',
'dbhost',
'dbport',
'dbname',
'dbusername',
'dbpassword',
];
const VALID_CLIENTS = ['sqlite', 'mysql', 'postgres', 'mongo'];
module.exports = function parseDatabaseArguments({ scope, args }) {
const argKeys = Object.keys(args);
const matchingArgs = DB_ARGS.filter(key => argKeys.includes(key));
const missingArgs = DB_ARGS.filter(key => !argKeys.includes(key));
if (matchingArgs.length === 0) return;
if (matchingArgs.length !== DB_ARGS.length && args.dbclient !== 'sqlite') {
return stopProcess(
`Required database arguments are missing: ${missingArgs.join(', ')}.`
);
}
if (!VALID_CLIENTS.includes(args.dbclient)) {
return stopProcess(
`Invalid client ${chalk.yellow(
args.dbclient
)}. Possible choices: ${VALID_CLIENTS.join(', ')}.`
);
}
scope.dbforce = args.dbforce !== undefined;
const database = {
settings: {
client: args.dbclient,
host: args.dbhost,
srv: args.dbsrv,
port: args.dbport,
database: args.dbname,
username: args.dbusername,
password: args.dbpassword,
filename: args.dbfile,
},
options: {},
};
if (args.dbauth !== undefined) {
database.options.authenticationDatabase = args.dbauth;
}
if (args.dbssl !== undefined) {
if (args.dbclient === 'mongo') {
database.options.ssl = args.dbssl === 'true';
} else {
database.settings.ssl = args.dbssl === 'true';
}
}
scope.database = database;
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0056 ]-- |