Handle oss tls

This commit is contained in:
Owen 2025-08-13 16:23:24 -07:00
parent 1f6379a7e6
commit 2c8bf4f18c
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD

View file

@ -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<any> {
export async function getTraefikConfig(exitNodeId: number): Promise<any> {
// 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,7 +231,9 @@ export async function getTraefikConfig(
preferWildcardCert = configDomain.prefer_wildcard_cert;
}
const tls = {
let tls = {};
if (build == "oss") {
tls = {
certResolver: certResolver,
...(preferWildcardCert
? {
@ -248,6 +245,7 @@ export async function getTraefikConfig(
}
: {})
};
}
const additionalMiddlewares =
config.getRawConfig().traefik.additional_middlewares || [];