traefik/templates/ecs.tmpl
2018-01-03 23:52:03 +01:00

152 lines
No EOL
4.9 KiB
Cheetah

[backends]
{{range $serviceName, $instances := .Services}}
{{if hasCircuitBreakerLabel $instances}}
[backends.backend-{{ $serviceName }}.circuitBreaker]
expression = "{{getCircuitBreakerExpression $instances}}"
{{end}}
{{if hasLoadBalancerLabel $instances}}
[backends.backend-{{ $serviceName }}.loadBalancer]
method = "{{ getLoadBalancerMethod $instances}}"
sticky = {{ getSticky $instances}}
{{if hasStickinessLabel $instances}}
[backends.backend-{{ $serviceName }}.loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $instances}}"
{{end}}
{{end}}
{{if hasMaxConnLabels $instances}}
[backends.backend-{{ $serviceName }}.maxConn]
amount = {{getMaxConnAmount $instances}}
extractorFunc = "{{getMaxConnExtractorFunc $instances}}"
{{end}}
{{ if hasHealthCheckLabels $instances }}
[backends.backend-{{ $serviceName }}.healthCheck]
path = "{{getHealthCheckPath $instances }}"
port = {{getHealthCheckPort $instances}}
interval = "{{getHealthCheckInterval $instances }}"
{{end}}
{{range $index, $instance := $instances}}
[backends.backend-{{ $instance.Name }}.servers.server-{{ $instance.Name }}{{ $instance.ID }}]
url = "{{ getProtocol $instance }}://{{ getHost $instance }}:{{ getPort $instance }}"
weight = {{ getWeight $instance}}
{{end}}
{{end}}
[frontends]
{{range $serviceName, $instances := .Services}}
{{range filterFrontends $instances}}
[frontends.frontend-{{ $serviceName }}]
backend = "backend-{{ $serviceName }}"
priority = {{ getPriority .}}
passHostHeader = {{ getPassHostHeader .}}
passTLSCert = {{ getPassTLSCert .}}
entryPoints = [{{range getEntryPoints .}}
"{{.}}",
{{end}}]
{{if getWhitelistSourceRange .}}
whitelistSourceRange = [{{range getWhitelistSourceRange .}}
"{{.}}",
{{end}}]
{{end}}
basicAuth = [{{range getBasicAuth .}}
"{{.}}",
{{end}}]
{{if hasRedirect .}}
[frontends."frontend-{{ $serviceName }}".redirect]
entryPoint = "{{getRedirectEntryPoint .}}"
regex = "{{getRedirectRegex .}}"
replacement = "{{getRedirectReplacement .}}"
{{end}}
[frontends."frontend-{{ $serviceName }}".headers]
{{if hasSSLRedirectHeaders .}}
SSLRedirect = {{getSSLRedirectHeaders .}}
{{end}}
{{if hasSSLTemporaryRedirectHeaders .}}
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders .}}
{{end}}
{{if hasSSLHostHeaders .}}
SSLHost = "{{getSSLHostHeaders .}}"
{{end}}
{{if hasSTSSecondsHeaders .}}
STSSeconds = {{getSTSSecondsHeaders .}}
{{end}}
{{if hasSTSIncludeSubdomainsHeaders .}}
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders .}}
{{end}}
{{if hasSTSPreloadHeaders .}}
STSPreload = {{getSTSPreloadHeaders .}}
{{end}}
{{if hasForceSTSHeaderHeaders .}}
ForceSTSHeader = {{getForceSTSHeaderHeaders .}}
{{end}}
{{if hasFrameDenyHeaders .}}
FrameDeny = {{getFrameDenyHeaders .}}
{{end}}
{{if hasCustomFrameOptionsValueHeaders .}}
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders .}}"
{{end}}
{{if hasContentTypeNosniffHeaders .}}
ContentTypeNosniff = {{getContentTypeNosniffHeaders .}}
{{end}}
{{if hasBrowserXSSFilterHeaders .}}
BrowserXSSFilter = {{getBrowserXSSFilterHeaders .}}
{{end}}
{{if hasContentSecurityPolicyHeaders .}}
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders .}}"
{{end}}
{{if hasPublicKeyHeaders .}}
PublicKey = "{{getPublicKeyHeaders .}}"
{{end}}
{{if hasReferrerPolicyHeaders .}}
ReferrerPolicy = "{{getReferrerPolicyHeaders .}}"
{{end}}
{{if hasIsDevelopmentHeaders .}}
IsDevelopment = {{getIsDevelopmentHeaders .}}
{{end}}
{{if hasRequestHeaders .}}
[frontends."frontend-{{ $serviceName }}".headers.customRequestHeaders]
{{range $k, $v := getRequestHeaders .}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasResponseHeaders .}}
[frontends."frontend-{{ $serviceName }}".headers.customResponseHeaders]
{{range $k, $v := getResponseHeaders .}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasAllowedHostsHeaders .}}
[frontends."frontend-{{ $serviceName }}".headers.AllowedHosts]
{{range getAllowedHostsHeaders .}}
"{{.}}"
{{end}}
{{end}}
{{if hasHostsProxyHeaders .}}
[frontends."frontend-{{ $serviceName }}".headers.HostsProxyHeaders]
{{range getHostsProxyHeaders .}}
"{{.}}"
{{end}}
{{end}}
{{if hasSSLProxyHeaders .}}
[frontends."frontend-{{ $serviceName }}".headers.SSLProxyHeaders]
{{range $k, $v := getSSLProxyHeaders .}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
[frontends.frontend-{{ $serviceName }}.routes.route-frontend-{{ $serviceName }}]
rule = "{{getFrontendRule .}}"
{{end}}
{{end}}