mirror of
https://github.com/fosrl/pangolin.git
synced 2025-12-16 13:06:27 +00:00
Working on making blueprints work
This commit is contained in:
@@ -107,7 +107,7 @@ export async function updateProxyResources(
|
|||||||
enabled: targetData.enabled,
|
enabled: targetData.enabled,
|
||||||
internalPort: internalPortToCreate,
|
internalPort: internalPortToCreate,
|
||||||
path: targetData.path,
|
path: targetData.path,
|
||||||
pathMatchType: targetData.pathMatchType
|
pathMatchType: targetData["path-match"]
|
||||||
})
|
})
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ export async function updateProxyResources(
|
|||||||
port: targetData.port,
|
port: targetData.port,
|
||||||
enabled: targetData.enabled,
|
enabled: targetData.enabled,
|
||||||
path: targetData.path,
|
path: targetData.path,
|
||||||
pathMatchType: targetData.pathMatchType
|
pathMatchType: targetData["path-match"]
|
||||||
})
|
})
|
||||||
.where(eq(targets.targetId, existingTarget.targetId))
|
.where(eq(targets.targetId, existingTarget.targetId))
|
||||||
.returning();
|
.returning();
|
||||||
@@ -424,7 +424,7 @@ export async function updateProxyResources(
|
|||||||
validateRule(rule);
|
validateRule(rule);
|
||||||
await trx.insert(resourceRules).values({
|
await trx.insert(resourceRules).values({
|
||||||
resourceId: existingResource.resourceId,
|
resourceId: existingResource.resourceId,
|
||||||
action: rule.action.toUpperCase(),
|
action: getRuleAction(rule.action),
|
||||||
match: rule.match.toUpperCase(),
|
match: rule.match.toUpperCase(),
|
||||||
value: rule.value,
|
value: rule.value,
|
||||||
priority: index + 1 // start priorities at 1
|
priority: index + 1 // start priorities at 1
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const TargetSchema = z.object({
|
|||||||
enabled: z.boolean().optional().default(true),
|
enabled: z.boolean().optional().default(true),
|
||||||
"internal-port": z.number().int().min(1).max(65535).optional(),
|
"internal-port": z.number().int().min(1).max(65535).optional(),
|
||||||
path: z.string().optional(),
|
path: z.string().optional(),
|
||||||
pathMatchType: z.enum(["exact", "prefix", "regex"]).optional().nullable()
|
"path-match": z.enum(["exact", "prefix", "regex"]).optional().nullable()
|
||||||
});
|
});
|
||||||
export type TargetData = z.infer<typeof TargetSchema>;
|
export type TargetData = z.infer<typeof TargetSchema>;
|
||||||
|
|
||||||
|
|||||||
@@ -348,7 +348,9 @@ export async function getTraefikConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let rule = `Host(\`${fullDomain}\`)`;
|
let rule = `Host(\`${fullDomain}\`)`;
|
||||||
|
let priority = 100;
|
||||||
if (resource.path && resource.pathMatchType) {
|
if (resource.path && resource.pathMatchType) {
|
||||||
|
priority += 1;
|
||||||
// add path to rule based on match type
|
// add path to rule based on match type
|
||||||
if (resource.pathMatchType === "exact") {
|
if (resource.pathMatchType === "exact") {
|
||||||
rule += ` && Path(\`${resource.path}\`)`;
|
rule += ` && Path(\`${resource.path}\`)`;
|
||||||
@@ -368,7 +370,7 @@ export async function getTraefikConfig(
|
|||||||
middlewares: routerMiddlewares,
|
middlewares: routerMiddlewares,
|
||||||
service: serviceName,
|
service: serviceName,
|
||||||
rule: rule,
|
rule: rule,
|
||||||
priority: 100,
|
priority: priority,
|
||||||
...(resource.ssl ? { tls } : {})
|
...(resource.ssl ? { tls } : {})
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -380,7 +382,7 @@ export async function getTraefikConfig(
|
|||||||
middlewares: [redirectHttpsMiddlewareName],
|
middlewares: [redirectHttpsMiddlewareName],
|
||||||
service: serviceName,
|
service: serviceName,
|
||||||
rule: rule,
|
rule: rule,
|
||||||
priority: 100
|
priority: priority
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user