fix: correct Strapi database configuration structure

The database config had an incorrect nested structure with
connection.client.connection which caused Strapi to fail with
'Cannot destructure property client of db.config.connection'.

Fixed to use the correct flat structure:
connection.client, connection.host, etc.
This commit is contained in:
echo 2026-02-24 18:01:30 +01:00
parent 0ef26ba2f1
commit 590a96e502

View File

@ -11,15 +11,13 @@ export default ({ env }) => {
if (client === 'postgres') { if (client === 'postgres') {
return { return {
connection: { connection: {
client, client: 'postgres',
connection: {
host: env('DATABASE_HOST', 'localhost'), host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 5432), port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'strapi'), database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'), user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'), password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false), ssl: env.bool('DATABASE_SSL', false),
},
pool: { min: 2, max: 10 }, pool: { min: 2, max: 10 },
}, },
}; };
@ -27,10 +25,8 @@ export default ({ env }) => {
return { return {
connection: { connection: {
client, client: 'sqlite',
connection: {
filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')), filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
},
useNullAsDefault: true, useNullAsDefault: true,
}, },
}; };