bc94ace7d3
Marathon label traefik.prefixes can be used to specify what prefixes to use. New example marathon-prefix.tmpl to take advantage of this new mechanism.
27 lines
1 KiB
Cheetah
27 lines
1 KiB
Cheetah
{{$apps := .Applications}}
|
|
[backends]{{range .Tasks}}
|
|
[backends.backend{{.AppID | replace "/" "-"}}.servers.server-{{.ID | replace "." "-"}}]
|
|
url = "http://{{.Host}}:{{getPort .}}"
|
|
{{$appID := .AppID}}
|
|
{{range $apps}}
|
|
{{if eq $appID .ID}}
|
|
weight = {{getWeight .}}
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
[frontends]{{ range $app := .Applications}}
|
|
{{range $prefix := getPrefixes .}}
|
|
[frontends.frontend{{$app.ID | replace "/" "-"}}{{$prefix | replace "/" "-"}}]
|
|
backend = "backend{{$app.ID | replace "/" "-"}}"
|
|
[frontends.frontend-{{getHost $app | replace "/" "-"}}{{$prefix | replace "/" "-"}}.routes.route-prefix{{$prefix | replace "/" "-"}}]
|
|
rule = "PathPrefix"
|
|
value = "{{.}}"
|
|
{{else}}
|
|
[frontends.frontend{{.ID | replace "/" "-"}}]
|
|
backend = "backend{{.ID | replace "/" "-"}}"
|
|
[frontends.frontend-{{getHost $app | replace "/" "-"}}.routes.route-host-{{getHost $app | replace "/" "-"}}]
|
|
rule = "Host"
|
|
value = "{{getHost $app | replace "/" "-"}}.{{$.Domain}}"
|
|
{{end}}
|
|
{{end}}
|