From 2c8bf4f18c04c67f9193c6eca603a70e37597e47 Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 13 Aug 2025 16:23:24 -0700 Subject: [PATCH] Handle oss tls --- server/routers/traefik/getTraefikConfig.ts | 40 ++++++++++------------ 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/server/routers/traefik/getTraefikConfig.ts b/server/routers/traefik/getTraefikConfig.ts index da013878..89afee2c 100644 --- a/server/routers/traefik/getTraefikConfig.ts +++ b/server/routers/traefik/getTraefikConfig.ts @@ -5,6 +5,7 @@ import logger from "@server/logger"; import HttpCode from "@server/types/HttpCode"; import config from "@server/lib/config"; import { orgs, resources, sites, Target, targets } from "@server/db"; +import { build } from "@server/build"; let currentExitNodeId: number; @@ -52,12 +53,9 @@ export async function traefikConfigProvider( } } -export async function getTraefikConfig( - exitNodeId: number -): Promise { +export async function getTraefikConfig(exitNodeId: number): Promise { // Get all resources with related data const allResources = await db.transaction(async (tx) => { - // Get the site(s) on this exit node const resourcesWithRelations = await tx .select({ @@ -86,10 +84,7 @@ export async function getTraefikConfig( .from(resources) .innerJoin(sites, eq(sites.siteId, resources.siteId)) .where( - or( - eq(sites.exitNodeId, exitNodeId), - isNull(sites.exitNodeId) - ) + or(eq(sites.exitNodeId, exitNodeId), isNull(sites.exitNodeId)) ); // Get all resource IDs from the first query @@ -134,7 +129,7 @@ export async function getTraefikConfig( }); if (!allResources.length) { - return {} + return {}; } const badgerMiddlewareName = "badger"; @@ -236,18 +231,21 @@ export async function getTraefikConfig( preferWildcardCert = configDomain.prefer_wildcard_cert; } - const tls = { - certResolver: certResolver, - ...(preferWildcardCert - ? { - domains: [ - { - main: wildCard - } - ] - } - : {}) - }; + let tls = {}; + if (build == "oss") { + tls = { + certResolver: certResolver, + ...(preferWildcardCert + ? { + domains: [ + { + main: wildCard + } + ] + } + : {}) + }; + } const additionalMiddlewares = config.getRawConfig().traefik.additional_middlewares || [];