From bbac3c93aa7c154d6837145c6465302b7273be1b Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Fri, 22 Apr 2022 14:15:02 +0300 Subject: [PATCH] Minor --- nginx.tmpl | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index bc1a6b2..74c5bfc 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -269,32 +269,29 @@ server { {{ $paths := groupBy $containers "Env.VIRTUAL_PATH" }} {{ $nPaths := len $paths }} -{{ $paths := groupBy $containers "Env.VIRTUAL_PATH" }} -{{ $nPaths := len $paths }} - {{ if eq $nPaths 0 }} # {{ $host }} {{ template "upstream" (dict "Upstream" $upstream_name "Containers" $containers "Networks" $CurrentContainer.Networks "Debug" $debug_all) }} {{ else }} {{ range $path, $containers := $paths }} - {{ range $container := $containers }} - {{ $addrLen := len $container.Addresses }} + {{ range $container := $containers }} + {{ $addrLen := len $container.Addresses }} - {{ range $knownNetwork := $CurrentContainer.Networks }} - {{ range $containerNetwork := $container.Networks }} - {{ if (and (ne $containerNetwork.Name "ingress") (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }} - ## Can be connected with "{{ $containerNetwork.Name }}" network - {{ $sum := sha1 $path }} - {{ $upstream := printf "%s-%s" $upstream_name $sum }} - # {{ $host }}{{ $path }} - {{ template "upstream" (dict "Upstream" $upstream "Containers" $containers "Networks" $CurrentContainer.Networks "Debug" $debug_all) }} - {{ else }} - # Cannot connect to network of this container - server 127.0.0.1 down; - {{ end }} - {{ end }} - {{ end }} - {{ end }} + {{ range $knownNetwork := $CurrentContainer.Networks }} + {{ range $containerNetwork := $container.Networks }} + {{ if (and (ne $containerNetwork.Name "ingress") (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }} + ## Can be connected with "{{ $containerNetwork.Name }}" network + {{ $sum := sha1 $path }} + {{ $upstream := printf "%s-%s" $upstream_name $sum }} + # {{ $host }}{{ $path }} + {{ template "upstream" (dict "Upstream" $upstream "Containers" $containers "Networks" $CurrentContainer.Networks "Debug" $debug_all) }} + {{ else }} + # Cannot connect to network of this container + server 127.0.0.1 down; + {{ end }} + {{ end }} + {{ end }} + {{ end }} {{ end }} {{ end }}