2016-04-12 10:49:37 +03:00
[backends]
2018-01-01 01:49:32 +03:00
{{range $ service := .Services}}
{{ $ sname := $ service . ServiceName }}
2016-04-12 10:49:37 +03:00
2018-01-01 01:49:32 +03:00
{{ $ circuitBreaker := getAttribute "backend.circuitbreaker" $ service . Attributes ""}}
2016-04-12 10:49:37 +03:00
{{with $ circuitBreaker }}
2018-01-01 01:49:32 +03:00
[backends."backend-{{ $ sname }}".circuitBreaker]
2016-04-12 10:49:37 +03:00
expression = "{{ $ circuitBreaker }}"
{{end}}
2018-01-01 01:49:32 +03:00
[backends."backend-{{ $ sname }}".loadBalancer]
method = "{{getAttribute "backend.loadbalancer" $ service . Attributes "wrr"}}"
sticky = {{getSticky $ service . Attributes }}
{{if hasStickinessLabel $ service . Attributes }}
[backends."backend-{{ $ sname }}".loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $ service . Attributes }}"
2017-10-10 12:10:02 +03:00
{{end}}
2016-08-25 06:46:47 +03:00
2018-01-01 01:49:32 +03:00
{{if hasMaxconnAttributes $ service . Attributes }}
[backends."backend-{{ $ sname }}".maxConn]
amount = {{getAttribute "backend.maxconn.amount" $ service . Attributes "" }}
extractorFunc = "{{getAttribute "backend.maxconn.extractorfunc" $ service . Attributes "" }}"
2016-08-25 06:46:47 +03:00
{{end}}
2018-01-01 01:49:32 +03:00
{{end}}
{{range $ index , $ node := .Nodes}}
[backends."backend-{{getBackend $ node }}".servers."{{getBackendName $ node $ index }}"]
url = "{{getAttribute "protocol" $ node . Service . Tags "http"}}://{{getBackendAddress $ node }}:{{ $ node . Service . Port }}"
weight = {{ getAttribute "backend.weight" $ node . Service . Tags "0" }}
2016-02-02 20:03:40 +03:00
{{end}}
2016-04-15 10:56:06 +03:00
[frontends]
2018-01-01 01:49:32 +03:00
{{range $ service := .Services}}
[frontends."frontend-{{ $ service . ServiceName }}"]
backend = "backend-{{ $ service . ServiceName }}"
priority = {{getAttribute "frontend.priority" $ service . Attributes "0"}}
passHostHeader = {{getAttribute "frontend.passHostHeader" $ service . Attributes "true"}}
{{ $ entryPoints := getAttribute "frontend.entrypoints" $ service . Attributes ""}}
{{with $ entryPoints }}
entryPoints = [{{range getEntryPoints $ entryPoints }}
2016-04-12 10:49:37 +03:00
"{{.}}",
2018-01-01 01:49:32 +03:00
{{end}}]
{{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}}