mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-03 17:44:44 +02:00
infer wild card cert if prefer flag is on
This commit is contained in:
parent
5c80f026bc
commit
e279d93570
2 changed files with 26 additions and 4 deletions
|
@ -34,10 +34,6 @@ export async function traefikConfigProvider(
|
|||
|
||||
// const baseDomain = new URL(config.app.base_url).hostname;
|
||||
|
||||
const tls = {
|
||||
certResolver: config.traefik.cert_resolver,
|
||||
};
|
||||
|
||||
const http: any = {
|
||||
routers: {},
|
||||
services: {},
|
||||
|
@ -68,6 +64,31 @@ export async function traefikConfigProvider(
|
|||
const routerName = `${target.targetId}-router`;
|
||||
const serviceName = `${target.targetId}-service`;
|
||||
|
||||
if (!resource.fullDomain) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const domainParts = resource.fullDomain.split(".");
|
||||
let wildCard;
|
||||
if (domainParts.length <= 2) {
|
||||
wildCard = `*.${domainParts.join(".")}`;
|
||||
} else {
|
||||
wildCard = `*.${domainParts.slice(1).join(".")}`;
|
||||
}
|
||||
|
||||
const tls = {
|
||||
certResolver: config.traefik.cert_resolver,
|
||||
...(config.traefik.prefer_wildcard_cert
|
||||
? {
|
||||
domains: [
|
||||
{
|
||||
main: wildCard
|
||||
},
|
||||
],
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
http.routers![routerName] = {
|
||||
entryPoints: [
|
||||
target.ssl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue