1
0
mirror of https://github.com/containous/traefik.git synced 2024-12-24 21:34:39 +03:00
traefik/templates/consul_catalog.tmpl

58 lines
1.8 KiB
Cheetah
Raw Normal View History

[backends]
{{range $service := .Services}}
{{$sname := $service.ServiceName}}
{{ $circuitBreaker := getCircuitBreaker $service.Attributes }}
{{if $circuitBreaker }}
[backends."backend-{{ $sname }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
{{end}}
{{ $loadBalancer := getLoadBalancer $service.Attributes }}
{{if $loadBalancer }}
[backends."backend-{{ $sname }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
sticky = {{ $loadBalancer.Sticky }}
{{if $loadBalancer.Stickiness }}
[backends."backend-{{ $sname }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
2017-10-10 12:10:02 +03:00
{{end}}
{{end}}
2016-08-25 06:46:47 +03:00
{{ $maxConn := getMaxConn $service.Attributes }}
{{if $maxConn }}
[backends."backend-{{ $sname }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2016-08-25 06:46:47 +03:00
{{end}}
{{end}}
{{range $index, $node := .Nodes}}
[backends."backend-{{ getBackend $node }}".servers."{{ getServerName $node $index }}"]
url = "{{ getProtocol $node.Service.Tags }}://{{ getBackendAddress $node }}:{{ $node.Service.Port }}"
weight = {{ getWeight $node.Service.Tags }}
2016-02-02 20:03:40 +03:00
{{end}}
[frontends]
{{range $service := .Services}}
[frontends."frontend-{{ $service.ServiceName }}"]
backend = "backend-{{ $service.ServiceName }}"
priority = {{ getPriority $service.Attributes }}
passHostHeader = {{ getPassHostHeader $service.Attributes }}
entryPoints = [{{range getFrontEndEntryPoints $service.Attributes }}
"{{.}}",
{{end}}]
basicAuth = [{{range getBasicAuth $service.Attributes }}
"{{.}}",
{{end}}]
[frontends."frontend-{{$service.ServiceName}}".routes."route-host-{{$service.ServiceName}}"]
rule = "{{ getFrontendRule $service }}"
2016-02-02 20:03:40 +03:00
{{end}}