traefik/templates/kv.tmpl

128 lines
3.9 KiB
Cheetah
Raw Normal View History

2017-12-23 16:45:51 +00:00
[backends]
{{range $backend := List .Prefix "/backends/"}}
{{$backendName := Last $backend}}
{{$circuitBreaker := Get "" $backend "/circuitbreaker/expression"}}
{{with $circuitBreaker}}
[backends."{{$backendName}}".circuitBreaker]
expression = "{{$circuitBreaker}}"
2017-12-23 16:45:51 +00:00
{{end}}
2017-12-23 16:45:51 +00:00
{{$loadBalancer := Get "" $backend "/loadbalancer/method"}}
{{with $loadBalancer}}
[backends."{{$backendName}}".loadBalancer]
method = "{{$loadBalancer}}"
2017-12-23 16:45:51 +00:00
sticky = {{ getSticky $backend }}
2017-10-10 09:10:02 +00:00
{{if hasStickinessLabel $backend}}
2017-10-16 15:38:03 +00:00
[backends."{{$backendName}}".loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $backend}}"
2017-10-10 09:10:02 +00:00
{{end}}
2017-12-23 16:45:51 +00:00
{{end}}
2017-12-23 16:45:51 +00:00
{{$maxConnAmt := Get "" $backend "/maxconn/amount"}}
{{$maxConnExtractorFunc := Get "" $backend "/maxconn/extractorfunc"}}
{{with $maxConnAmt}}
{{with $maxConnExtractorFunc}}
[backends."{{$backendName}}".maxConn]
amount = {{$maxConnAmt}}
extractorFunc = "{{$maxConnExtractorFunc}}"
2017-12-23 16:45:51 +00:00
{{end}}
{{end}}
{{$healthCheck := Get "" $backend "/healthcheck/path"}}
{{with $healthCheck}}
[backends."{{$backendName}}".healthCheck]
path = "{{$healthCheck}}"
port = {{ Get "0" $backend "/healthcheck/port" }}
2017-12-23 16:45:51 +00:00
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}}
2015-09-21 16:05:56 +00:00
{{end}}
2017-12-23 16:45:51 +00:00
[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"}}
passTLSCert = {{Get "false" $frontend "/passtlscert"}}
2017-12-23 16:45:51 +00:00
{{$entryPoints := SplitGet $frontend "/entrypoints"}}
2016-02-01 15:08:58 +00:00
entryPoints = [{{range $entryPoints}}
"{{.}}",
2017-12-23 16:45:51 +00:00
{{end}}]
{{$whitelistSourceRange := SplitGet $frontend "/whitelistsourcerange"}}
whitelistSourceRange = [{{range $whitelistSourceRange}}
"{{.}}",
{{end}}]
2018-01-03 15:32:11 +00:00
{{$basicAuth := SplitGet $frontend "/basicauth"}}
basicAuth = [{{range $basicAuth}}
"{{.}}",
{{end}}]
{{$redirect := getRedirect $frontend }}
{{ if $redirect }}
[frontends."{{$frontendName}}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
{{end}}
{{ $errorPages := getErrorPages $frontend }}
{{ if $errorPages }}
[frontends."{{$frontendName}}".errors]
{{ range $pageName, $page := $errorPages }}
[frontends."{{$frontendName}}".errors.{{ $pageName }}]
status = [{{range $page.Status}}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ $rateLimit := getRateLimit $frontend }}
{{ if $rateLimit }}
[frontends."{{$frontendName}}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."{{$frontendName}}".rateLimit.rateSet]
{{ range $limitName, $rateLimit := $rateLimit.RateSet }}
[frontends."{{$frontendName}}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
2017-12-23 16:45:51 +00:00
{{range $route := List $frontend "/routes/"}}
[frontends."{{$frontendName}}".routes."{{Last $route}}"]
rule = "{{Get "" $route "/rule"}}"
{{end}}
{{end}}
2017-12-23 16:45:51 +00:00
{{range $tlsConfiguration := List .Prefix "/tlsconfiguration/"}}
[[tlsConfiguration]]
2017-12-23 16:45:51 +00:00
{{$entryPoints := SplitGet $tlsConfiguration "/entrypoints"}}
entryPoints = [{{range $entryPoints}}
"{{.}}",
{{end}}]
2017-12-23 16:45:51 +00:00
[tlsConfiguration.certificate]
certFile = """{{Get "" $tlsConfiguration "/certificate/certfile"}}"""
keyFile = """{{Get "" $tlsConfiguration "/certificate/keyfile"}}"""
{{end}}