1
0
mirror of https://github.com/nginx-proxy/nginx-proxy synced 2024-11-08 07:49:22 +01:00

refactor: rename VIRTUAL_HOST_YAML -> VIRTUAL_HOST_MULTIPORTS

This commit is contained in:
Nicolas Duchon 2024-05-03 00:12:14 +02:00
parent 216eae9f70
commit 47e2838e61
No known key found for this signature in database
GPG Key ID: EA3151C66A4D79E7
2 changed files with 12 additions and 9 deletions

@ -495,8 +495,8 @@ proxy_set_header X-Original-URI $request_uri;
proxy_set_header Proxy "";
{{- end }}
{{- /* Precompute some information about vhost that use VIRTUAL_HOST_YAML. */}}
{{- range $vhosts_yaml, $containers := groupBy $globals.containers "Env.VIRTUAL_HOST_YAML" }}
{{- /* Precompute and store some information about vhost that use VIRTUAL_HOST_MULTIPORTS. */}}
{{- range $vhosts_yaml, $containers := groupBy $globals.containers "Env.VIRTUAL_HOST_MULTIPORTS" }}
{{- range $hostname, $vhost := (fromYaml $vhosts_yaml) }}
{{- $vhost_data := when (hasKey $globals.vhosts $hostname) (get $globals.vhosts $hostname) (dict) }}
{{- $paths := coalesce $vhost_data.paths (dict) }}
@ -529,7 +529,7 @@ proxy_set_header Proxy "";
{{- end }}
{{- end }}
{{- /* Precompute some information about vhost that use VIRTUAL_HOST. */}}
{{- /* Precompute and store some information about vhost that use VIRTUAL_HOST. */}}
{{- range $hostname, $containers := groupByMulti $globals.containers "Env.VIRTUAL_HOST" "," }}
{{- /* Ignore containers with VIRTUAL_HOST set to the empty string. */}}
{{- $hostname = trim $hostname }}
@ -537,8 +537,10 @@ proxy_set_header Proxy "";
{{- continue }}
{{- end }}
{{/* Drop containers with VIRTUAL_HOST_YAML set (VIRTUAL_HOST_YAML takes precedence). */}}
{{- range $_, $containers_to_drop := groupBy $containers "Env.VIRTUAL_HOST_YAML" }}
{{- /* Drop containers with both VIRTUAL_HOST and VIRTUAL_HOST_MULTIPORTS set
* (VIRTUAL_HOST_MULTIPORTS takes precedence thanks to the previous loop).
*/}}
{{- range $_, $containers_to_drop := groupBy $containers "Env.VIRTUAL_HOST_MULTIPORTS" }}
{{- range $container := $containers_to_drop }}
{{- $containers = without $containers $container }}
{{- end }}
@ -575,6 +577,7 @@ proxy_set_header Proxy "";
{{- $_ := set $globals.vhosts $hostname $vhost_data }}
{{- end }}
{{- /* Loop over $globals.vhosts and update it with the remaining informations about each vhost. */}}
{{- range $hostname, $vhost_data := $globals.vhosts }}
{{- $vhost_containers := list }}
{{- range $path, $vpath_data := $vhost_data.paths }}

@ -8,7 +8,7 @@ services:
environment:
WEB_PORTS: "81"
VIRTUAL_HOST: skipped.nginx-proxy.tld
VIRTUAL_HOST_YAML: |-
VIRTUAL_HOST_MULTIPORTS: |-
notskipped.nginx-proxy.tld:
defaultport:
@ -18,7 +18,7 @@ services:
- "8080"
environment:
WEB_PORTS: "80 8080"
VIRTUAL_HOST_YAML: |-
VIRTUAL_HOST_MULTIPORTS: |-
port80.a.nginx-proxy.tld:
port80.b.nginx-proxy.tld:
port80.c.nginx-proxy.tld:
@ -31,7 +31,7 @@ services:
- "9000"
environment:
WEB_PORTS: "8080 9000"
VIRTUAL_HOST_YAML: |-
VIRTUAL_HOST_MULTIPORTS: |-
port8080.nginx-proxy.tld:
"/":
port: 8080
@ -46,7 +46,7 @@ services:
- "10002"
environment:
WEB_PORTS: "10001 10002"
VIRTUAL_HOST_YAML: |-
VIRTUAL_HOST_MULTIPORTS: |-
virtualpaths.nginx-proxy.tld:
"/rootdest":
port: 10001