diff --git a/example/traefik.nomad.hcl b/example/traefik.nomad.hcl index 7442ad8..fb7ce27 100644 --- a/example/traefik.nomad.hcl +++ b/example/traefik.nomad.hcl @@ -2,6 +2,7 @@ job "traefik" { datacenters = ["dc1"] + region = "global" priority = 70 diff --git a/templates/traefik.yml.tpl b/templates/traefik.yml.tpl index 6bbea62..42214f5 100644 --- a/templates/traefik.yml.tpl +++ b/templates/traefik.yml.tpl @@ -15,9 +15,13 @@ entryPoints: [[- if or (not (has $def "enabled")) ($def.enabled) ]] [[ $name ]]: address: ":{{ env "NOMAD_PORT_[[ $name | regexp.Replace "[\\.\\-]" "_" ]]" }}[[ if has $def "protocol" ]]/[[ $def.protocol ]][[ end ]]" - [[- if gt (len $.traefik.trusted_proxies) 0 ]] + [[- $trusted_proxies := $.traefik.trusted_proxies ]] + [[- if has $def "trusted_proxies" ]] + [[- $trusted_proxies = $def.trusted_proxies ]] + [[- end ]] + [[- if gt (len $trusted_proxies) 0 ]] proxyProtocol: - trustedIPs:[[ range $idx, $ip := $.traefik.trusted_proxies ]] + trustedIPs:[[ range $idx, $ip := $trusted_proxies ]] - [[ $ip ]][[ end ]] [[- end ]] [[- if has $def "http" ]]