refactor(mesos): template readability.

This commit is contained in:
Fernandez Ludovic 2018-01-10 03:19:22 +01:00 committed by Traefiker
parent f1f2e1bf64
commit e9d2124885

View file

@ -1,18 +1,29 @@
{{$apps := .Applications}}
[backends]{{range .Tasks}}
[backends.backend{{getBackend . $apps}}.servers.server-{{getID .}}]
url = "{{getProtocol . $apps}}://{{getHost .}}:{{getPort . $apps}}"
weight = {{getWeight . $apps}}
{{ $apps := .Applications }}
[backends]
{{range $task := .Tasks }}
{{ $backendName := getBackend $task $apps }}
[backends.backend-{{ $backendName }}.servers.server-{{ getID $task }}]
url = "{{ getProtocol $task $apps }}://{{ getHost $task }}:{{ getPort $task $apps }}"
weight = {{ getWeight $task $apps }}
{{end}}
[frontends]{{range .Applications}}
[frontends.frontend-{{getFrontEndName .}}]
backend = "backend{{getFrontendBackend .}}"
passHostHeader = {{getPassHostHeader .}}
priority = {{getPriority .}}
entryPoints = [{{range getEntryPoints .}}
"{{.}}",
{{end}}]
[frontends.frontend-{{getFrontEndName .}}.routes.route-host{{getFrontEndName .}}]
rule = "{{getFrontendRule .}}"
[frontends]
{{range $app := $apps }}
{{ $frontendName := getFrontEndName $app }}
[frontends.frontend-{{ $frontendName }}]
backend = "backend-{{ getFrontendBackend $app }}"
priority = {{ getPriority $app }}
passHostHeader = {{ getPassHostHeader $app }}
entryPoints = [{{range getEntryPoints $app }}
"{{.}}",
{{end}}]
[frontends.frontend-{{ $frontendName }}.routes.route-host-{{ $frontendName }}]
rule = "{{ getFrontendRule $app }}"
{{end}}