174 lines
No EOL
5.9 KiB
Cheetah
174 lines
No EOL
5.9 KiB
Cheetah
[backends]
|
|
{{range $serviceName, $instances := .Services }}
|
|
{{ $firstInstance := index $instances 0 }}
|
|
|
|
{{ $circuitBreaker := getCircuitBreaker $firstInstance }}
|
|
{{if $circuitBreaker }}
|
|
[backends."backend-{{ $serviceName }}".circuitBreaker]
|
|
expression = "{{ $circuitBreaker.Expression }}"
|
|
{{end}}
|
|
|
|
{{ $loadBalancer := getLoadBalancer $firstInstance }}
|
|
{{if $loadBalancer }}
|
|
[backends."backend-{{ $serviceName }}".loadBalancer]
|
|
method = "{{ $loadBalancer.Method }}"
|
|
sticky = {{ $loadBalancer.Sticky }}
|
|
{{if $loadBalancer.Stickiness }}
|
|
[backends."backend-{{ $serviceName }}".loadBalancer.stickiness]
|
|
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{ $maxConn := getMaxConn $firstInstance }}
|
|
{{if $maxConn }}
|
|
[backends."backend-{{ $serviceName }}".maxConn]
|
|
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
|
|
amount = {{ $maxConn.Amount }}
|
|
{{end}}
|
|
|
|
{{ $healthCheck := getHealthCheck $firstInstance }}
|
|
{{if $healthCheck }}
|
|
[backends.backend-{{ $serviceName }}.healthCheck]
|
|
path = "{{ $healthCheck.Path }}"
|
|
port = {{ $healthCheck.Port }}
|
|
interval = "{{ $healthCheck.Interval }}"
|
|
{{end}}
|
|
|
|
{{ $buffering := getBuffering $firstInstance }}
|
|
{{if $buffering }}
|
|
[backends.backend-{{ $serviceName }}.buffering]
|
|
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
|
|
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
|
|
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
|
|
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
|
|
retryExpression = "{{ $buffering.RetryExpression }}"
|
|
{{end}}
|
|
|
|
{{range $serverName, $server := getServers $instances }}
|
|
[backends.backend-{{ $serviceName }}.servers.{{ $serverName }}]
|
|
url = "{{ $server.URL }}"
|
|
weight = {{ $server.Weight }}
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
[frontends]
|
|
{{range $serviceName, $instances := .Services }}
|
|
{{range $instance := filterFrontends $instances }}
|
|
|
|
[frontends.frontend-{{ $serviceName }}]
|
|
backend = "backend-{{ $serviceName }}"
|
|
priority = {{ getPriority $instance }}
|
|
passHostHeader = {{ getPassHostHeader $instance }}
|
|
passTLSCert = {{ getPassTLSCert $instance }}
|
|
|
|
entryPoints = [{{range getEntryPoints $instance }}
|
|
"{{.}}",
|
|
{{end}}]
|
|
|
|
{{ $whitelistSourceRange := getWhitelistSourceRange $instance }}
|
|
{{if $whitelistSourceRange }}
|
|
whitelistSourceRange = [{{range $whitelistSourceRange }}
|
|
"{{.}}",
|
|
{{end}}]
|
|
{{end}}
|
|
|
|
basicAuth = [{{range getBasicAuth $instance }}
|
|
"{{.}}",
|
|
{{end}}]
|
|
|
|
|
|
{{ $redirect := getRedirect $instance }}
|
|
{{if $redirect }}
|
|
[frontends."frontend-{{ $serviceName }}".redirect]
|
|
entryPoint = "{{ $redirect.EntryPoint }}"
|
|
regex = "{{ $redirect.Regex }}"
|
|
replacement = "{{ $redirect.Replacement }}"
|
|
permanent = {{ $redirect.Permanent }}
|
|
{{end}}
|
|
|
|
{{ $errorPages := getErrorPages $instance }}
|
|
{{if $errorPages }}
|
|
[frontends."frontend-{{ $serviceName }}".errors]
|
|
{{range $pageName, $page := $errorPages }}
|
|
[frontends."frontend-{{ $serviceName }}".errors.{{ $pageName }}]
|
|
status = [{{range $page.Status }}
|
|
"{{.}}",
|
|
{{end}}]
|
|
backend = "{{ $page.Backend }}"
|
|
query = "{{ $page.Query }}"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{ $rateLimit := getRateLimit $instance }}
|
|
{{if $rateLimit }}
|
|
[frontends."frontend-{{ $serviceName }}".rateLimit]
|
|
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
|
|
[frontends."frontend-{{ $serviceName }}".rateLimit.rateSet]
|
|
{{ range $limitName, $limit := $rateLimit.RateSet }}
|
|
[frontends."frontend-{{ $serviceName }}".rateLimit.rateSet.{{ $limitName }}]
|
|
period = "{{ $limit.Period }}"
|
|
average = {{ $limit.Average }}
|
|
burst = {{ $limit.Burst }}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{ $headers := getHeaders $instance }}
|
|
{{if $headers }}
|
|
[frontends."frontend-{{ $serviceName }}".headers]
|
|
SSLRedirect = {{ $headers.SSLRedirect }}
|
|
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
|
|
SSLHost = "{{ $headers.SSLHost }}"
|
|
STSSeconds = {{ $headers.STSSeconds }}
|
|
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
|
|
STSPreload = {{ $headers.STSPreload }}
|
|
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
|
|
FrameDeny = {{ $headers.FrameDeny }}
|
|
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
|
|
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
|
|
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
|
|
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
|
|
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
|
|
PublicKey = "{{ $headers.PublicKey }}"
|
|
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
|
|
IsDevelopment = {{ $headers.IsDevelopment }}
|
|
|
|
{{if $headers.AllowedHosts }}
|
|
AllowedHosts = [{{range $headers.AllowedHosts }}
|
|
"{{.}}",
|
|
{{end}}]
|
|
{{end}}
|
|
|
|
{{if $headers.HostsProxyHeaders }}
|
|
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
|
|
"{{.}}",
|
|
{{end}}]
|
|
{{end}}
|
|
|
|
{{if $headers.CustomRequestHeaders }}
|
|
[frontends."frontend-{{ $serviceName }}".headers.customRequestHeaders]
|
|
{{range $k, $v := $headers.CustomRequestHeaders }}
|
|
{{$k}} = "{{$v}}"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{if $headers.CustomResponseHeaders }}
|
|
[frontends."frontend-{{ $serviceName }}".headers.customResponseHeaders]
|
|
{{range $k, $v := $headers.CustomResponseHeaders }}
|
|
{{$k}} = "{{$v}}"
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{if $headers.SSLProxyHeaders }}
|
|
[frontends."frontend-{{ $serviceName }}".headers.SSLProxyHeaders]
|
|
{{range $k, $v := $headers.SSLProxyHeaders }}
|
|
{{$k}} = "{{$v}}"
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
[frontends.frontend-{{ $serviceName }}.routes.route-frontend-{{ $serviceName }}]
|
|
rule = "{{getFrontendRule $instance}}"
|
|
|
|
{{end}}
|
|
{{end}} |