Support passing whole context to traefik_middlewares

This commit is contained in:
Daniel Berteaud 2024-01-17 16:10:00 +01:00
parent ec581ab748
commit ef9fa3450f

View File

@ -1 +1,13 @@
[[- join (coll.Flatten (coll.Slice .base_middlewares .middlewares)) "," -]]
[[- /*
# vim: syntax=hcl
# Note: for compatibility, we take traefik either from .traefik (when passing the whole context to the template)
# or from . (when only .traefik is passed as context)
*/ -]]
[[- $traefik := dict ]]
[[- if and (has . "traefik") (isKind "map" .traefik) ]]
[[- $traefik = .traefik ]]
[[- else ]]
[[ $traefik = . ]]
[[- end -]]
[[- join (coll.Flatten (coll.Slice $traefik.base_middlewares $traefik.middlewares)) "," -]]