1
0
mirror of https://github.com/nginx-proxy/nginx-proxy synced 2025-05-02 06:05:26 +02:00

refactor: apply suggestions from code review

This commit is contained in:
Nicolas Duchon 2024-07-29 20:47:02 +02:00 committed by GitHub
parent 0bc51906dd
commit 6c24397582
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -125,7 +125,7 @@
*/}}
{{- define "container_port" }}
{{- /* If only 1 port exposed, use that as a default, else 80. */}}
# exposed ports:{{ range $index, $address := (sortObjectsByKeysAsc $.container.Addresses "Port") }}{{ if lt $index 10 }} {{ $address.Port }}/{{ $address.Proto }}{{ end }}{{ else }} (none){{ end }}
# exposed ports (first ten):{{ range $index, $address := (sortObjectsByKeysAsc $.container.Addresses "Port") }}{{ if lt $index 10 }} {{ $address.Port }}/{{ $address.Proto }}{{ end }}{{ else }} (none){{ end }}
{{- $default_port := when (eq (len $.container.Addresses) 1) (first $.container.Addresses).Port "80" }}
# default port: {{ $default_port }}
{{- $port := when (eq $.port "default") $default_port (when (eq $.port "legacy") (or $.container.Env.VIRTUAL_PORT $default_port) $.port) }}