From 71df1f2187d846fe30869ec37bf232237e91de8a Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sat, 16 Mar 2019 17:07:12 +0900 Subject: [PATCH] Better formatting for nginx file --- Production/nginx.tmpl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Production/nginx.tmpl b/Production/nginx.tmpl index 4c4aaf6..01ba8f0 100644 --- a/Production/nginx.tmpl +++ b/Production/nginx.tmpl @@ -3,19 +3,19 @@ {{ if .Address }} {{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}} {{ if and .Container.Node.ID .Address.HostPort }} - # {{ .Container.Node.Name }}/{{ .Container.Name }} - server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }}; + # {{ .Container.Node.Name }}/{{ .Container.Name }} + server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }}; {{/* If there is no swarm node or the port is not published on host, use container's IP:PORT */}} {{ else if .Network }} - # {{ .Container.Name }} - server {{ .Network.IP }}:{{ .Address.Port }}; + # {{ .Container.Name }} + server {{ .Network.IP }}:{{ .Address.Port }}; {{ end }} {{ else if .Network }} - # {{ .Container.Name }} + # {{ .Container.Name }} {{ if .Network.IP }} - server {{ .Network.IP }} down; + server {{ .Network.IP }} down; {{ else }} - server 127.0.0.1 down; + server 127.0.0.1 down; {{ end }} {{ end }} @@ -198,7 +198,7 @@ upstream {{ $upstream_name }} { {{ 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 + ## Can be connected with "{{ $containerNetwork.Name }}" network {{/* If only 1 port exposed, use that */}} {{ if eq $addrLen 1 }} @@ -211,8 +211,8 @@ upstream {{ $upstream_name }} { {{ template "upstream" (dict "Container" $container "Address" $address "Network" $containerNetwork) }} {{ end }} {{ else }} - # Cannot connect to network of this container - server 127.0.0.1 down; + # Cannot connect to network of this container + server 127.0.0.1 down; {{ end }} {{ end }} {{ end }}