feat: Laravel

This commit is contained in:
Andras Bacsai 2022-04-29 22:24:14 +02:00
parent 531973baab
commit e5b1ce4eef
2 changed files with 26 additions and 7 deletions

View File

@ -394,10 +394,6 @@ export function setDefaultBaseImage(buildPack) {
} }
]; ];
const laravelVersions = [ const laravelVersions = [
{
value: 'webdevops/php-nginx:8.0-alpine',
label: 'webdevops/php-nginx:8.0-alpine'
},
{ {
value: 'webdevops/php-apache:8.0-alpine', value: 'webdevops/php-apache:8.0-alpine',
label: 'webdevops/php-apache:8.0-alpine' label: 'webdevops/php-apache:8.0-alpine'
@ -436,9 +432,8 @@ export function setDefaultBaseImage(buildPack) {
payload.baseImages = phpVersions; payload.baseImages = phpVersions;
} }
if (buildPack === 'laravel') { if (buildPack === 'laravel') {
payload.baseImage = 'webdevops/php-nginx:8.0-alpine'; payload.baseImage = 'webdevops/php-apache:8.0-alpine';
payload.baseBuildImage = 'node:18'; payload.baseBuildImage = 'node:18';
payload.baseImages = laravelVersions;
payload.baseBuildImages = nodeVersions; payload.baseBuildImages = nodeVersions;
} }
return payload; return payload;

View File

@ -1,7 +1,7 @@
import { getUserDetails } from '$lib/common'; import { getUserDetails } from '$lib/common';
import * as db from '$lib/database'; import * as db from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit'; import type { RequestHandler } from '@sveltejs/kit';
import { ErrorHandler } from '$lib/database'; import { ErrorHandler, generatePassword } from '$lib/database';
export const get: RequestHandler = async (event) => { export const get: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event); const { teamId, status, body } = await getUserDetails(event);
@ -34,6 +34,30 @@ export const post: RequestHandler = async (event) => {
try { try {
await db.configureBuildPack({ id, buildPack }); 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 }; return { status: 201 };
} catch (error) { } catch (error) {
return ErrorHandler(error); return ErrorHandler(error);