如何在 KRL Webhook 中选择参数?

发布于 2024-10-06 07:51:38 字数 713 浏览 0 评论 0原文

我想在网站更新时运行一些 KRL 规则。推送更新后,部署脚本将获取以下 URL:

http://webhooks.kynetxapps.net/t/_appid_/updated?site=production&version=123456abcdef

处理此 Webhook 的规则集如下所示:

rule site_updated {
    select when webhook updated
    pre {
        site = event:param("site");
        version = event:param("version");
    }
    // do something with site and version
}

来自 http://docs.kynetx.com/docs/Event_API 我可以制定更具体的规则:

select when webhook updated site "test"
    or webhook updated site "production"

有没有办法在没有 PRE 块的情况下获取这两个参数?将 SELECT 与 Webhook 结合使用的最佳方式是什么?

I want to run some KRL rules when a website is updated. The deploy script will get the following URL after pushing the updates:

http://webhooks.kynetxapps.net/t/_appid_/updated?site=production&version=123456abcdef

The ruleset to handle this webhook starts out like this:

rule site_updated {
    select when webhook updated
    pre {
        site = event:param("site");
        version = event:param("version");
    }
    // do something with site and version
}

From http://docs.kynetx.com/docs/Event_API I could make more specific rules with:

select when webhook updated site "test"
    or webhook updated site "production"

Is there a way to get both parameters without a PRE block? What is the best way to use SELECT with a webhook?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深已缘浅 2024-10-13 07:51:38

规则过滤器(如 site "test")是正则表达式,您可以使用 setting () 子句设置变量。

http://webhooks.kynetxapps.net/t/_appid_/update?site=production&version=123456abcdef

select when webhook update site "(.*)" setting(site)

导致 site 在不使用前置块的情况下设置为 生产。由于这是一个正则表达式,因此您可以匹配任何内容,例如两个选项之一:

select when webhook update site "(test|production)" setting(site)

仅与 site == test 或 site == production 匹配,其他时间不匹配,并将值存储在 site 变量的上下文中规则。

Rule filters (like site "test") are regular expressions, and you can set variables using the setting () clause.

http://webhooks.kynetxapps.net/t/_appid_/update?site=production&version=123456abcdef

select when webhook update site "(.*)" setting(site)

causes site to be set to production without using a pre block. As this is a regular expression, you can match anything, like either of two options:

select when webhook update site "(test|production)" setting(site)

will only match with site == test or site == production, and no other times, AND store the value in the site variable in the context of the rule.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文