1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-06-30 22:05:46 +00:00

feat: print warning on unparsable VIRTUAL_HOST_MULTIPORTS

This commit is contained in:
Nicolas Duchon
2024-05-03 22:21:21 +02:00
parent 0baff189bc
commit 53e9a03ac9
3 changed files with 75 additions and 1 deletions

View File

@ -459,7 +459,19 @@ proxy_set_header Proxy "";
{{- /* 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) }}
{{- /* Print a warning in the config if VIRTUAL_HOST_MULTIPORTS can't be parsed. */}}
{{- $parsedVhosts := fromYaml $vhosts_yaml }}
{{- if (empty $parsedVhosts) }}
{{- $containerNames := list }}
{{- range $container := $containers }}
{{- $containerNames = append $containerNames $container.Name }}
{{- end }}
# /!\ WARNING: the VIRTUAL_HOST_MULTIPORTS environment variable used for {{ len $containerNames | plural "this container" "those containers" }} is not a valid YAML string:
# {{ $containerNames | join ", " }}
{{- continue }}
{{- end }}
{{- range $hostname, $vhost := $parsedVhosts }}
{{- $vhost_data := when (hasKey $globals.vhosts $hostname) (get $globals.vhosts $hostname) (dict) }}
{{- $paths := coalesce $vhost_data.paths (dict) }}