traefik/templates/kv.tmpl
2018-01-02 11:46:02 +01:00

81 lines
2.4 KiB
Cheetah

[backends]
{{range $backend := List .Prefix "/backends/"}}
{{$backendName := Last $backend}}
{{$circuitBreaker := Get "" $backend "/circuitbreaker/expression"}}
{{with $circuitBreaker}}
[backends."{{$backendName}}".circuitBreaker]
expression = "{{$circuitBreaker}}"
{{end}}
{{$loadBalancer := Get "" $backend "/loadbalancer/method"}}
{{with $loadBalancer}}
[backends."{{$backendName}}".loadBalancer]
method = "{{$loadBalancer}}"
sticky = {{ getSticky $backend }}
{{if hasStickinessLabel $backend}}
[backends."{{$backendName}}".loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $backend}}"
{{end}}
{{end}}
{{$maxConnAmt := Get "" $backend "/maxconn/amount"}}
{{$maxConnExtractorFunc := Get "" $backend "/maxconn/extractorfunc"}}
{{with $maxConnAmt}}
{{with $maxConnExtractorFunc}}
[backends."{{$backendName}}".maxConn]
amount = {{$maxConnAmt}}
extractorFunc = "{{$maxConnExtractorFunc}}"
{{end}}
{{end}}
{{$healthCheck := Get "" $backend "/healthcheck/path"}}
{{with $healthCheck}}
[backends."{{$backendName}}".healthCheck]
path = "{{$healthCheck}}"
interval = "{{ Get "30s" $backend "/healthcheck/interval" }}"
{{end}}
{{range $server := ListServers $backend}}
[backends."{{$backendName}}".servers."{{Last $server}}"]
url = "{{Get "" $server "/url"}}"
weight = {{Get "0" $server "/weight"}}
{{end}}
{{end}}
[frontends]
{{range $frontend := List .Prefix "/frontends/" }}
{{$frontendName := Last $frontend}}
[frontends."{{$frontendName}}"]
backend = "{{Get "" $frontend "/backend"}}"
priority = {{Get "0" $frontend "/priority"}}
passHostHeader = {{Get "true" $frontend "/passHostHeader"}}
{{$entryPoints := SplitGet $frontend "/entrypoints"}}
entryPoints = [{{range $entryPoints}}
"{{.}}",
{{end}}]
{{range $route := List $frontend "/routes/"}}
[frontends."{{$frontendName}}".routes."{{Last $route}}"]
rule = "{{Get "" $route "/rule"}}"
{{end}}
{{end}}
{{range $tlsConfiguration := List .Prefix "/tlsconfiguration/"}}
[[tlsConfiguration]]
{{$entryPoints := SplitGet $tlsConfiguration "/entrypoints"}}
entryPoints = [{{range $entryPoints}}
"{{.}}",
{{end}}]
[tlsConfiguration.certificate]
certFile = """{{Get "" $tlsConfiguration "/certificate/certfile"}}"""
keyFile = """{{Get "" $tlsConfiguration "/certificate/keyfile"}}"""
{{end}}