diff --git a/cf_gateway_rule_create.js b/cf_gateway_rule_create.js index bf9e73d..d069a00 100644 --- a/cf_gateway_rule_create.js +++ b/cf_gateway_rule_create.js @@ -1,13 +1,11 @@ import { createZeroTrustRule, getZeroTrustLists } from "./lib/api.js"; const { result: lists } = await getZeroTrustLists(); -const wirefilterExpression = lists.reduce((previous, current, index) => { +const wirefilterExpression = lists.reduce((previous, current) => { if (!current.name.startsWith("CGPS List")) return previous; - // Remove the trailing ' or ' - if (index === lists.length - 1) return previous.slice(0, -4); - return `${previous} any(dns.domains[*] in \$${current.id}) or `; }, ""); -await createZeroTrustRule(wirefilterExpression); +// Remove the trailing ' or ' +await createZeroTrustRule(wirefilterExpression.slice(0, -4));