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 05:10:17 +03:00
{{ $ circuitBreaker := getCircuitBreaker $ service . Attributes }}
{{if $ circuitBreaker }}
[backends."backend-{{ $ sname }}".circuitBreaker]
expression = "{{ $ circuitBreaker . Expression }}"
2016-04-12 10:49:37 +03:00
{{end}}
2018-01-01 05:10:17 +03:00
{{ $ 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}}
2018-01-01 05:10:17 +03:00
{{end}}
2016-08-25 06:46:47 +03:00
2018-01-01 05:10:17 +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}}
2018-01-01 05:49:06 +03:00
{{ $ healthCheck := getHealthCheck $ service . Attributes }}
{{if $ healthCheck }}
[backends.backend-{{ $ sname }}.healthCheck]
path = "{{ $ healthCheck . Path }}"
port = {{ $ healthCheck . Port }}
interval = "{{ $ healthCheck . Interval }}"
{{end}}
2018-01-01 01:49:32 +03:00
{{end}}
{{range $ index , $ node := .Nodes}}
2018-01-01 05:10:17 +03:00
[backends."backend-{{ getBackend $ node }}".servers."{{ getServerName $ node $ index }}"]
url = "{{ getProtocol $ node . Service . Tags }}://{{ getBackendAddress $ node }}:{{ $ node . Service . Port }}"
weight = {{ getWeight $ node . Service . Tags }}
2018-01-01 01:49:32 +03:00
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}}
2018-01-01 05:10:17 +03:00
[frontends."frontend-{{ $ service . ServiceName }}"]
backend = "backend-{{ $ service . ServiceName }}"
priority = {{ getPriority $ service . Attributes }}
passHostHeader = {{ getPassHostHeader $ service . Attributes }}
2018-01-01 05:22:53 +03:00
passTLSCert = {{ getPassTLSCert $ service . Attributes }}
2018-01-01 01:49:32 +03:00
2018-01-01 05:10:17 +03:00
entryPoints = [{{range getFrontEndEntryPoints $ service . Attributes }}
2016-04-12 10:49:37 +03:00
"{{.}}",
2018-01-01 01:49:32 +03:00
{{end}}]
2018-01-01 05:37:24 +03:00
{{ $ whitelistSourceRange := getWhitelistSourceRange $ service . Attributes }}
{{if $ whitelistSourceRange }}
whitelistSourceRange = [{{range $ whitelistSourceRange }}
"{{.}}",
{{end}}]
{{end}}
2018-01-01 05:10:17 +03:00
basicAuth = [{{range getBasicAuth $ service . Attributes }}
2018-01-01 01:49:32 +03:00
"{{.}}",
{{end}}]
2018-01-01 06:03:29 +03:00
{{ $ redirect := getRedirect $ service . Attributes }}
{{if $ redirect }}
[frontends."frontend-{{ $ service . ServiceName }}".redirect]
entryPoint = "{{ $ redirect . EntryPoint }}"
regex = "{{ $ redirect . Regex }}"
replacement = "{{ $ redirect . Replacement }}"
{{end}}
2018-01-01 06:38:10 +03:00
{{ if hasErrorPages $ service . Attributes }}
[frontends."frontend-{{ $ service . ServiceName }}".errors]
{{ range $ pageName , $ page := getErrorPages $ service . Attributes }}
[frontends."frontend-{{ $ service . ServiceName }}".errors.{{ $ pageName }}]
status = [{{range $ page . Status }}
"{{.}}",
{{end}}]
backend = "{{ $ page . Backend }}"
query = "{{ $ page . Query }}"
{{end}}
{{end}}
{{ if hasRateLimit $ service . Attributes }}
{{ $ rateLimit := getRateLimit $ service . Attributes }}
[frontends."frontend-{{ $ service . ServiceName }}".rateLimit]
extractorFunc = "{{ $ rateLimit . ExtractorFunc }}"
[frontends."frontend-{{ $ service . ServiceName }}".rateLimit.rateSet]
{{ range $ limitName , $ limit := $ rateLimit . RateSet }}
[frontends."frontend-{{ $ service . ServiceName }}".rateLimit.rateSet.{{ $ limitName }}]
period = "{{ $ limit . Period }}"
average = {{ $ limit . Average }}
burst = {{ $ limit . Burst }}
{{end}}
{{end}}
2018-01-01 01:49:32 +03:00
[frontends."frontend-{{ $ service . ServiceName }}".routes."route-host-{{ $ service . ServiceName }}"]
2018-01-01 05:10:17 +03:00
rule = "{{ getFrontendRule $ service }}"
2018-01-01 01:49:32 +03:00
2016-02-02 20:03:40 +03:00
{{end}}