Open itshikanov opened 1 year ago
I'm trying to use Custom filters JavaScript replace filter. Here is example https://github.com/HeavyHorst/remco/blob/26a321844506ca53d2840f22e41ed6ea89043cba/docs/content/template/template-filters.md
{% for member in gets("/members/*") %}
{% set data = member.Value | parseJSON %}
{{ data.conn_url | split:"/" | index:"2" | replace:"@,/" }}
{% endfor %}
got error
2023-07-11T15:30:29.414+0300 [INFO] set backend nodes: backend=zookeeper nodes=["192.168.50.1:2181"] prefix=remco[1642]
2023/07/11 15:30:29 Connected to 192.168.50.1:2181
2023/07/11 15:30:29 Authenticated: id=72058294651455021, timeout=4000
2023/07/11 15:30:29 Re-submitting `0` credentials after reconnect
2023-07-11T15:30:29.420+0300 [ERROR] failed to process: prefix=remco[1642] resource=haproxy error="createStageFileAndSync failed: create stage file failed: template execution failed: [Error (where: javascript-filter:replace) | Line 35 Col 44 near 'replace'] TypeError: Object has no member 'replace' at replace (<eval>:10:23(48))"
2023-07-11T15:30:29.420+0300 [ERROR] not all templates could be rendered, trying again after 22 seconds: prefix=remco[1642] resource=haproxy
That work
{{ data.conn_url | toJSON | replace:"@,/" }}
I think because "data.conn_url | toJSON" become String. But if use another pipe, the type of data is changing. If there was toSRING filter at least, it will work
Hello. I.m try convert my confd config to remco.
try to use filter and function together from here https://github.com/HeavyHorst/remco/tree/26a321844506ca53d2840f22e41ed6ea89043cba/docs/content/template
here the code
and here another try
Got the error with replace function
How can i use function and filter together?