84 lines
2.4 KiB
Cheetah
84 lines
2.4 KiB
Cheetah
{{$frontends := List .Prefix "/frontends/" }}
|
|
{{$backends := List .Prefix "/backends/"}}
|
|
{{$tls := List .Prefix "/tls/"}}
|
|
|
|
[backends]{{range $backends}}
|
|
{{$backend := .}}
|
|
{{$backendName := Last $backend}}
|
|
{{$servers := ListServers $backend }}
|
|
|
|
{{$circuitBreaker := Get "" . "/circuitbreaker/" "expression"}}
|
|
{{with $circuitBreaker}}
|
|
[backends."{{$backendName}}".circuitBreaker]
|
|
expression = "{{$circuitBreaker}}"
|
|
{{end}}
|
|
|
|
{{$loadBalancer := Get "" . "/loadbalancer/" "method"}}
|
|
{{with $loadBalancer}}
|
|
[backends."{{$backendName}}".loadBalancer]
|
|
method = "{{$loadBalancer}}"
|
|
sticky = {{ getSticky . }}
|
|
{{if hasStickinessLabel $backend}}
|
|
[backends."{{$backendName}}".loadBalancer.stickiness]
|
|
cookieName = "{{getStickinessCookieName $backend}}"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{$healthCheck := Get "" . "/healthcheck/" "path"}}
|
|
{{with $healthCheck}}
|
|
[backends."{{$backendName}}".healthCheck]
|
|
path = "{{$healthCheck}}"
|
|
interval = "{{ Get "30s" $backend "/healthcheck/" "interval" }}"
|
|
{{end}}
|
|
|
|
{{$maxConnAmt := Get "" . "/maxconn/" "amount"}}
|
|
{{$maxConnExtractorFunc := Get "" . "/maxconn/" "extractorfunc"}}
|
|
{{with $maxConnAmt}}
|
|
{{with $maxConnExtractorFunc}}
|
|
[backends."{{$backendName}}".maxConn]
|
|
amount = {{$maxConnAmt}}
|
|
extractorFunc = "{{$maxConnExtractorFunc}}"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{range $servers}}
|
|
[backends."{{$backendName}}".servers."{{Last .}}"]
|
|
url = "{{Get "" . "/url"}}"
|
|
weight = {{Get "0" . "/weight"}}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
[frontends]{{range $frontends}}
|
|
{{$frontend := Last .}}
|
|
{{$entryPoints := GetList . "/entrypoints"}}
|
|
[frontends."{{$frontend}}"]
|
|
backend = "{{Get "" . "/backend"}}"
|
|
{{ $passHostHeader := Get "" . "/passhostheader"}}
|
|
{{if $passHostHeader}}
|
|
passHostHeader = {{ $passHostHeader }}
|
|
{{else}}
|
|
# keep for compatibility reason
|
|
passHostHeader = {{Get "true" . "/passHostHeader"}}
|
|
{{end}}
|
|
priority = {{Get "0" . "/priority"}}
|
|
entryPoints = [{{range $entryPoints}}
|
|
"{{.}}",
|
|
{{end}}]
|
|
{{$routes := List . "/routes/"}}
|
|
{{range $routes}}
|
|
[frontends."{{$frontend}}".routes."{{Last .}}"]
|
|
rule = "{{Get "" . "/rule"}}"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{range $tls}}
|
|
{{$entryPoints := SplitGet . "/entrypoints"}}
|
|
[[tls]]
|
|
entryPoints = [{{range $entryPoints}}
|
|
"{{.}}",
|
|
{{end}}]
|
|
[tls.certificate]
|
|
certFile = """{{Get "" . "/certificate" "/certfile"}}"""
|
|
keyFile = """{{Get "" . "/certificate" "/keyfile"}}"""
|
|
{{end}}
|
|
|