feat: custom previewseparator

This commit is contained in:
Andras Bacsai
2022-11-29 13:29:11 +01:00
parent ffdc158d44
commit c6273e9177
7 changed files with 64 additions and 4 deletions

View File

@@ -46,6 +46,7 @@ export async function gitLabEvents(request: FastifyRequest<GitLabEvents>) {
if (!webhookToken && !isDev) {
throw { status: 500, message: 'Invalid webhookToken.' }
}
const settings = await prisma.setting.findUnique({ where: { id: '0' } });
if (objectKind === 'push') {
const projectId = Number(project_id);
const branch = ref.split('/')[2];
@@ -140,7 +141,7 @@ export async function gitLabEvents(request: FastifyRequest<GitLabEvents>) {
data: {
pullmergeRequestId,
sourceBranch,
customDomain: `${protocol}${pullmergeRequestId}.${getDomain(application.fqdn)}`,
customDomain: `${protocol}${pullmergeRequestId}${settings.previewSeparator}${getDomain(application.fqdn)}`,
application: { connect: { id: application.id } }
}
})