diff --git a/src/lib/buildPacks/common.ts b/src/lib/buildPacks/common.ts index 1bdf75656..d9f3416b9 100644 --- a/src/lib/buildPacks/common.ts +++ b/src/lib/buildPacks/common.ts @@ -394,10 +394,6 @@ export function setDefaultBaseImage(buildPack) { } ]; const laravelVersions = [ - { - value: 'webdevops/php-nginx:8.0-alpine', - label: 'webdevops/php-nginx:8.0-alpine' - }, { value: 'webdevops/php-apache:8.0-alpine', label: 'webdevops/php-apache:8.0-alpine' @@ -436,9 +432,8 @@ export function setDefaultBaseImage(buildPack) { payload.baseImages = phpVersions; } if (buildPack === 'laravel') { - payload.baseImage = 'webdevops/php-nginx:8.0-alpine'; + payload.baseImage = 'webdevops/php-apache:8.0-alpine'; payload.baseBuildImage = 'node:18'; - payload.baseImages = laravelVersions; payload.baseBuildImages = nodeVersions; } return payload; diff --git a/src/routes/applications/[id]/configuration/buildpack.json.ts b/src/routes/applications/[id]/configuration/buildpack.json.ts index 3f1374f17..6e06ba44b 100644 --- a/src/routes/applications/[id]/configuration/buildpack.json.ts +++ b/src/routes/applications/[id]/configuration/buildpack.json.ts @@ -1,7 +1,7 @@ import { getUserDetails } from '$lib/common'; import * as db from '$lib/database'; import type { RequestHandler } from '@sveltejs/kit'; -import { ErrorHandler } from '$lib/database'; +import { ErrorHandler, generatePassword } from '$lib/database'; export const get: RequestHandler = async (event) => { const { teamId, status, body } = await getUserDetails(event); @@ -34,6 +34,30 @@ export const post: RequestHandler = async (event) => { try { await db.configureBuildPack({ id, buildPack }); + + // Generate default secrets + if (buildPack === 'laravel') { + let found = await db.isSecretExists({ id, name: 'APP_ENV', isPRMRSecret: false }); + if (!found) { + await db.createSecret({ + id, + name: 'APP_ENV', + value: 'production', + isBuildSecret: false, + isPRMRSecret: false + }); + } + found = await db.isSecretExists({ id, name: 'APP_KEY', isPRMRSecret: false }); + if (!found) { + await db.createSecret({ + id, + name: 'APP_KEY', + value: generatePassword(32), + isBuildSecret: false, + isPRMRSecret: false + }); + } + } return { status: 201 }; } catch (error) { return ErrorHandler(error);