glance
glance copied to clipboard
Allow passing argument to subrequest
Description
For some of my custom widgets i need to make a secondary requestt based on the result of the main request. But i cannot make subrequest with runtime arguments:
example
- type: custom-api
title: Crowdsec
url: http://100.95.200.149:8090/v1/decisions
subrequests:
ipinfo:
url: getip.com/{{IP}}
template: |
<ul class="list list-gap-5 collapsible-container" data-collapse-after="5">
{{ range .JSON.Array "" | sortByInt "id" "asc" }}
<li>scenario: {{ .Int "id" }} decision: {{ .String "type" }} ip: {{ .String "value" }}
{{ $hb := .Subrequest "ipinfo" .Int “value” }}
country: {{ hb.String "country" }}
</li>
{{ end }}
</ul>
Also a bit similar to #555
This is now possible in >=v0.8.0.