mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-26 14:56:39 +00:00
updated the sync and creation of new rules objects to include priorities passed by blueprints.
This commit is contained in:
committed by
Owen Schwartz
parent
46e62b24cf
commit
4d73488f0c
@@ -587,13 +587,15 @@ export async function updateProxyResources(
|
|||||||
|
|
||||||
// Sync rules
|
// Sync rules
|
||||||
for (const [index, rule] of resourceData.rules?.entries() || []) {
|
for (const [index, rule] of resourceData.rules?.entries() || []) {
|
||||||
|
const intendedPriority = rule.priority ?? index + 1;
|
||||||
const existingRule = existingRules[index];
|
const existingRule = existingRules[index];
|
||||||
if (existingRule) {
|
if (existingRule) {
|
||||||
if (
|
if (
|
||||||
existingRule.action !== getRuleAction(rule.action) ||
|
existingRule.action !== getRuleAction(rule.action) ||
|
||||||
existingRule.match !== rule.match.toUpperCase() ||
|
existingRule.match !== rule.match.toUpperCase() ||
|
||||||
existingRule.value !==
|
existingRule.value !==
|
||||||
getRuleValue(rule.match.toUpperCase(), rule.value)
|
getRuleValue(rule.match.toUpperCase(), rule.value) ||
|
||||||
|
existingRule.priority !== intendedPriority
|
||||||
) {
|
) {
|
||||||
validateRule(rule);
|
validateRule(rule);
|
||||||
await trx
|
await trx
|
||||||
@@ -604,7 +606,8 @@ export async function updateProxyResources(
|
|||||||
value: getRuleValue(
|
value: getRuleValue(
|
||||||
rule.match.toUpperCase(),
|
rule.match.toUpperCase(),
|
||||||
rule.value
|
rule.value
|
||||||
)
|
),
|
||||||
|
priority: intendedPriority
|
||||||
})
|
})
|
||||||
.where(
|
.where(
|
||||||
eq(resourceRules.ruleId, existingRule.ruleId)
|
eq(resourceRules.ruleId, existingRule.ruleId)
|
||||||
@@ -620,7 +623,7 @@ export async function updateProxyResources(
|
|||||||
rule.match.toUpperCase(),
|
rule.match.toUpperCase(),
|
||||||
rule.value
|
rule.value
|
||||||
),
|
),
|
||||||
priority: index + 1 // start priorities at 1
|
priority: intendedPriority
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -809,7 +812,7 @@ export async function updateProxyResources(
|
|||||||
action: getRuleAction(rule.action),
|
action: getRuleAction(rule.action),
|
||||||
match: rule.match.toUpperCase(),
|
match: rule.match.toUpperCase(),
|
||||||
value: getRuleValue(rule.match.toUpperCase(), rule.value),
|
value: getRuleValue(rule.match.toUpperCase(), rule.value),
|
||||||
priority: index + 1 // start priorities at 1
|
priority: rule.priority ?? index + 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user