Fix consul catalog issue with dot in serviceName

Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
Emile Vauge 2016-06-22 22:43:20 +02:00
parent e4ed7fd8f7
commit 15e04bb55d
No known key found for this signature in database
GPG key ID: D808B4C167352E59

View file

@ -1,7 +1,7 @@
[backends] [backends]
{{range $index, $node := .Nodes}} {{range $index, $node := .Nodes}}
{{if ne (getAttribute "enable" $node.Service.Tags "true") "false"}} {{if ne (getAttribute "enable" $node.Service.Tags "true") "false"}}
[backends.backend-{{getBackend $node}}.servers.{{getBackendName $node $index}}] [backends."backend-{{getBackend $node}}".servers."{{getBackendName $node $index}}"]
url = "{{getAttribute "protocol" $node.Service.Tags "http"}}://{{getBackendAddress $node}}:{{$node.Service.Port}}" url = "{{getAttribute "protocol" $node.Service.Tags "http"}}://{{getBackendAddress $node}}:{{$node.Service.Port}}"
{{$weight := getAttribute "backend.weight" $node.Service.Tags ""}} {{$weight := getAttribute "backend.weight" $node.Service.Tags ""}}
{{with $weight}} {{with $weight}}
@ -14,20 +14,20 @@
{{$service := .ServiceName}} {{$service := .ServiceName}}
{{$circuitBreaker := getAttribute "backend.circuitbreaker" .Attributes ""}} {{$circuitBreaker := getAttribute "backend.circuitbreaker" .Attributes ""}}
{{with $circuitBreaker}} {{with $circuitBreaker}}
[backends.backend-{{$service}}.circuitbreaker] [backends."backend-{{$service}}".circuitbreaker]
expression = "{{$circuitBreaker}}" expression = "{{$circuitBreaker}}"
{{end}} {{end}}
{{$loadBalancer := getAttribute "backend.loadbalancer" .Attributes ""}} {{$loadBalancer := getAttribute "backend.loadbalancer" .Attributes ""}}
{{with $loadBalancer}} {{with $loadBalancer}}
[backends.backend-{{$service}}.loadbalancer] [backends."backend-{{$service}}".loadbalancer]
method = "{{$loadBalancer}}" method = "{{$loadBalancer}}"
{{end}} {{end}}
{{end}} {{end}}
[frontends] [frontends]
{{range .Services}} {{range .Services}}
[frontends.frontend-{{.ServiceName}}] [frontends."frontend-{{.ServiceName}}"]
backend = "backend-{{.ServiceName}}" backend = "backend-{{.ServiceName}}"
passHostHeader = {{getAttribute "frontend.passHostHeader" .Attributes "true"}} passHostHeader = {{getAttribute "frontend.passHostHeader" .Attributes "true"}}
priority = {{getAttribute "frontend.priority" .Attributes "0"}} priority = {{getAttribute "frontend.priority" .Attributes "0"}}
@ -37,6 +37,6 @@
"{{.}}", "{{.}}",
{{end}}] {{end}}]
{{end}} {{end}}
[frontends.frontend-{{.ServiceName}}.routes.route-host-{{.ServiceName}}] [frontends."frontend-{{.ServiceName}}".routes."route-host-{{.ServiceName}}"]
rule = "{{getFrontendRule .}}" rule = "{{getFrontendRule .}}"
{{end}} {{end}}