mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-29 22:19:31 +02:00
Handle oss tls
This commit is contained in:
parent
1f6379a7e6
commit
2c8bf4f18c
1 changed files with 19 additions and 21 deletions
|
@ -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 || [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue