如何在 KRL Webhook 中选择参数?
我想在网站更新时运行一些 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
规则过滤器(如
site "test"
)是正则表达式,您可以使用setting ()
子句设置变量。导致
site
在不使用前置块的情况下设置为生产
。由于这是一个正则表达式,因此您可以匹配任何内容,例如两个选项之一:仅与 site == test 或 site == production 匹配,其他时间不匹配,并将值存储在 site 变量的上下文中规则。
Rule filters (like
site "test"
) are regular expressions, and you can set variables using thesetting ()
clause.causes
site
to be set toproduction
without using a pre block. As this is a regular expression, you can match anything, like either of two options: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.