Ensure the proxy service is not defined twice
This commit is contained in:
parent
aadad370f1
commit
dcc9c53387
|
@ -7,9 +7,11 @@
|
|||
[[- if and .proxy.enabled (has .proxy "service_name") (or (eq (urlParse .proxy.address).Hostname "localhost") (urlParse .proxy.address).Hostname "127.0.0.1") ]]
|
||||
[[- $connect_proxy = .proxy.service_name ]]
|
||||
[[- end ]]
|
||||
[[- $connect_services := coll.Slice ]]
|
||||
[[- if or (gt (len .consul.connect.upstreams) 0) (ne $connect_proxy "") ]]
|
||||
proxy {
|
||||
[[- range $idx, $upstream := .consul.connect.upstreams ]]
|
||||
[[- $connect_services = append $upstream.destination_name $connect_services ]]
|
||||
upstreams {
|
||||
destination_name = [[ $upstream.destination_name | toJSON ]]
|
||||
local_bind_port = [[ $upstream.local_bind_port ]]
|
||||
|
@ -30,7 +32,7 @@
|
|||
[[- end ]]
|
||||
}
|
||||
[[- end ]]
|
||||
[[- if ne $connect_proxy "" ]]
|
||||
[[- if and (ne $connect_proxy "") (not (has $connect_services $connect_proxy)) ]]
|
||||
# Connect to the proxy service through the mesh
|
||||
upstreams {
|
||||
destination_name = [[ $connect_proxy | toJSON ]]
|
||||
|
|
Loading…
Reference in New Issue