Compare commits

..

2 Commits

Author SHA1 Message Date
5262e73a12 cms fix 2026-02-24 18:02:03 +01:00
590a96e502 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.
2026-02-24 18:01:30 +01:00
2 changed files with 10 additions and 14 deletions

View File

@ -31,7 +31,7 @@ RUN addgroup -g 1001 -S nodejs && \
# Copy built application from builder stage # Copy built application from builder stage
COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
COPY --from=builder --chown=nodejs:nodejs /app/config ./config COPY --from=builder --chown=nodejs:nodejs /app/dist/config ./config
COPY --from=builder --chown=nodejs:nodejs /app/public ./public COPY --from=builder --chown=nodejs:nodejs /app/public ./public
COPY --from=builder --chown=nodejs:nodejs /app/favicon.png ./favicon.png COPY --from=builder --chown=nodejs:nodejs /app/favicon.png ./favicon.png
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules

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,
}, },
}; };