From f4cd93bd362cccbd4ef38199e504dc6202975eb7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 6 Sep 2022 10:14:39 +0200 Subject: [PATCH] test allowedlist --- apps/api/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 289b2fddf..bd2fe73b3 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -5,7 +5,7 @@ import env from '@fastify/env'; import cookie from '@fastify/cookie'; import path, { join } from 'path'; import autoLoad from '@fastify/autoload'; -import { asyncExecShell, createRemoteEngineConfiguration, isDev, listSettings, prisma, version } from './lib/common'; +import { asyncExecShell, createRemoteEngineConfiguration, getDomain, isDev, listSettings, prisma, version } from './lib/common'; import { scheduler } from './lib/scheduler'; import { compareVersions } from 'compare-versions'; import Graceful from '@ladjs/graceful' @@ -100,9 +100,9 @@ fastify.addHook('onRequest', async (request, reply) => { let allowedList = ['coolify:3000']; const { ipv4, ipv6, fqdn } = await prisma.setting.findFirst({}) - ipv4 && allowedList.push(ipv4); + ipv4 && allowedList.push(`${ipv4}:3000`); ipv6 && allowedList.push(ipv6); - fqdn && allowedList.push(fqdn); + fqdn && allowedList.push(getDomain(fqdn)); const remotes = await prisma.destinationDocker.findMany({ where: { remoteEngine: true, remoteVerified: true } }) if (remotes.length > 0) {