Open
Description
The default value of a variable cannot contain a new line (\n
) character because .*
doesn't match those. I.e. if you have this in your .env
file:
FOO="${BAR:-multi
line}"
You get this error mesage:
2024/07/02 02:49:54 Invalid template: "${BAR:-multi\nline}"
This is a bit confusing, because this doesn't look like an invalid template. Because of the quotes the whole string is correctly parsed, the template has a valid name and does end with }
. To fix this you need to change this regular expression:
compose-go/template/template.go
Line 31 in 9d0d133
To this:
var substitutionBraced = "[_a-z][_a-z0-9]*(?::?[-+?]((?:.|\n)*))?"
(I don't know if there is another way to match anything, including a \n
, in Go.)
Metadata
Assignees
Labels
No labels