* consul/kv.tmpl: weight default value should be a int Fix #821 * Use 0 as default weight in all backends
54 lines
1.6 KiB
Cheetah
54 lines
1.6 KiB
Cheetah
{{$frontends := List .Prefix "/frontends/" }}
|
|
{{$backends := List .Prefix "/backends/"}}
|
|
|
|
[backends]{{range $backends}}
|
|
{{$backend := .}}
|
|
{{$servers := ListServers $backend }}
|
|
|
|
{{$circuitBreaker := Get "" . "/circuitbreaker/" "expression"}}
|
|
{{with $circuitBreaker}}
|
|
[backends."{{Last $backend}}".circuitBreaker]
|
|
expression = "{{$circuitBreaker}}"
|
|
{{end}}
|
|
|
|
{{$loadBalancer := Get "" . "/loadbalancer/" "method"}}
|
|
{{$sticky := Get "false" . "/loadbalancer/" "sticky"}}
|
|
{{with $loadBalancer}}
|
|
[backends."{{Last $backend}}".loadBalancer]
|
|
method = "{{$loadBalancer}}"
|
|
sticky = {{$sticky}}
|
|
{{end}}
|
|
|
|
{{$maxConnAmt := Get "" . "/maxconn/" "amount"}}
|
|
{{$maxConnExtractorFunc := Get "" . "/maxconn/" "extractorfunc"}}
|
|
{{with $maxConnAmt}}
|
|
{{with $maxConnExtractorFunc}}
|
|
[backends."{{Last $backend}}".maxConn]
|
|
amount = {{$maxConnAmt}}
|
|
extractorFunc = "{{$maxConnExtractorFunc}}"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{range $servers}}
|
|
[backends."{{Last $backend}}".servers."{{Last .}}"]
|
|
url = "{{Get "" . "/url"}}"
|
|
weight = {{Get "0" . "/weight"}}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
[frontends]{{range $frontends}}
|
|
{{$frontend := Last .}}
|
|
{{$entryPoints := SplitGet . "/entrypoints"}}
|
|
[frontends."{{$frontend}}"]
|
|
backend = "{{Get "" . "/backend"}}"
|
|
passHostHeader = {{Get "true" . "/passHostHeader"}}
|
|
priority = {{Get "0" . "/priority"}}
|
|
entryPoints = [{{range $entryPoints}}
|
|
"{{.}}",
|
|
{{end}}]
|
|
{{$routes := List . "/routes/"}}
|
|
{{range $routes}}
|
|
[frontends."{{$frontend}}".routes."{{Last .}}"]
|
|
rule = "{{Get "" . "/rule"}}"
|
|
{{end}}
|
|
{{end}}
|