1
0
Fork 0

feat(consul-provider): If Service.Address is nil then use Node.Address

test(consul-catalog): Test on backend-name and backend-address
This commit is contained in:
Poney baker 2016-04-15 09:56:06 +02:00
parent 2f5c9273ee
commit 378a261e64
3 changed files with 117 additions and 12 deletions

View file

@ -1,9 +1,9 @@
[backends]
{{range .Nodes}}
{{if ne (getAttribute "enable" .Service.Tags "true") "false"}}
[backends.backend-{{getBackend .}}.servers.{{.Service.Service | replace "." "-"}}--{{.Service.Address | replace "." "-"}}--{{.Service.Port}}]
url = "{{getAttribute "protocol" .Service.Tags "http"}}://{{.Service.Address}}:{{.Service.Port}}"
{{$weight := getAttribute "backend.weight" .Service.Tags ""}}
{{range $index, $node := .Nodes}}
{{if ne (getAttribute "enable" $node.Service.Tags "true") "false"}}
[backends.backend-{{getBackend $node}}.servers.{{getBackendName $node $index}}]
url = "{{getAttribute "protocol" $node.Service.Tags "http"}}://{{getBackendAddress $node}}:{{$node.Service.Port}}"
{{$weight := getAttribute "backend.weight" $node.Service.Tags ""}}
{{with $weight}}
weight = {{$weight}}
{{end}}
@ -25,7 +25,8 @@
{{end}}
{{end}}
[frontends]{{range .Services}}
[frontends]
{{range .Services}}
[frontends.frontend-{{.ServiceName}}]
backend = "backend-{{.ServiceName}}"
passHostHeader = {{getAttribute "frontend.passHostHeader" .Attributes "false"}}