我已经创建了一个基于索引创建新的观察者或删除现有的观察者的观察者。基本上它为索引的每个记录创建一个观察者,然后这些观察者执行每周审计,并为索引中标识的团队发送电子邮件(html格式)。
到目前为止一切顺利...我有问题的有效载荷的长度在网钩,但我解决了它。
但现在我面临着另一个问题:
主观察器(创建另一个观察器的那个)在某个索引中执行搜索。我使用mustach代码来使用结果在它创建的每个新观察器中发送适当的负载。
但问题是,创建的监视器将执行其他搜索,这些搜索将用于填充发送的邮件。
不幸的是,我不能使用mustach引用,因为它将在创建观察者本身的过程中被解释。
有人知道如何防止webhook有效负载的某个部分中的mustach标记被解释吗?
exemple:
Main watcher:
create a set of new watchers using the webhook:
"foreach": "ctx.payload.to_be_created",
"max_iterations": 60,
"webhook": {
"scheme": "https",
"host": "xxxxx",
"port": xxxxx,
"method": "put",
"path": "_watcher/watch/{{ctx.payload._source.watchername}}",
"params": {},
"headers": {},
"auth": {
"basic": {
"username": "xxxx",
"password": "xxxx"
}
},
"body": """New Watchers to be created with mustach tag that needs to be interpreted, meaning value must be filled for the new watcher creation{{ctx.payload._source.watchername}} and mustach tag that should not be interpreted because they are part of the main code of the new watcher {{ctx.payload.bipbip.value}}"""
}
}
},
and the new watcher should be like this:
Now, the new watcher when we edit it, once createc by the webhook shouyld look like this, with one tag interpreted, and the second one left so when this new watcher will be executed it could be interpreted.:
New Watchers to be created with mustach tag that needs to be interpreted, meaning value must be filled for the new watcher creation "this tag has been interpreted" and mustach tag that should not be interpreted because they are part of the main code of the new watcher {{ctx.payload.bipbip.value}}
1条答案
按热度按时间ukqbszuj1#
得到了答案,对于那些可能感兴趣的人:
分隔符章节位于:https://mustache.github.io/mustache.5.html