Skip to content

Commit 6057a7b

Browse files
authored
fix use of x-* attribute in go templates (#22403)
## Description fix https://docs.docker.com/compose/bridge/customize/#add-your-own-templates as attributes with a `-` can't be accessed directly using dot-notation in a go template. See https://stackoverflow.com/questions/48146448/range-through-values-within-variable-containing-dashes-in-golang-templates ## Related issues or tickets ## Reviews - [ ] Technical review - [ ] Editorial review - [ ] Product review Signed-off-by: Nicolas De Loof <[email protected]>
1 parent b720d48 commit 6057a7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/manuals/compose/bridge/customize.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ metadata:
133133
spec:
134134
rules:
135135
{{ range $name, $service := .services }}
136-
{{ if $service.x-virtual-host }}
137-
- host: ${{ $service.x-virtual-host }}
136+
{{ range index $service "x-virtual-host" }}
137+
- host: ${{ . }}
138138
http:
139139
paths:
140140
- path: "/"

0 commit comments

Comments
 (0)