fix(laravel): apply runtime DB config and startup entrypoint
Laravel images no longer bake config:cache at build time, which ignored K8s DB env vars. Add DB_CONNECTION, clear config on boot, generate APP_KEY when missing, run migrations, and rebuild caches at container start. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -435,7 +435,14 @@ export class KubernetesService implements OnModuleInit {
|
||||
(ctx.runtime === AppRuntime.LARAVEL || ctx.runtime === AppRuntime.PHP) &&
|
||||
ctx.databaseType !== DatabaseType.NONE
|
||||
) {
|
||||
const dbConnection =
|
||||
ctx.databaseType === DatabaseType.POSTGRESQL
|
||||
? 'pgsql'
|
||||
: ctx.databaseType === DatabaseType.MONGODB
|
||||
? 'mongodb'
|
||||
: 'mysql';
|
||||
extraEnv.push(
|
||||
{ name: 'DB_CONNECTION', value: dbConnection },
|
||||
{ name: 'DB_DATABASE', value: ctx.appName.replace(/-/g, '_') },
|
||||
{ name: 'DB_USERNAME', valueFrom: { secretKeyRef: { name: `${ctx.appName}-db-secret`, key: 'username' } } },
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user