Open vvuk opened 3 hours ago
Actually, wait. #9570 claims it was fixed in https://github.com/compose-spec/compose-go/pull/336 but the source change (which is the same that remains today):
case '_', '.', '-', '[', ']':
default:
// variable name should match [A-Za-z0-9_.-]
if unicode.IsLetter(rune) || unicode.IsNumber(rune) {
continue
}
return "", "", inherited, fmt.Errorf(
`line %d: unexpected character %q in variable name %q`,
p.line, string(rune), strings.Split(src, "\n")[0])
}
the patch added '-'
to the case statement, but it would have fallen through default anyway -- and the following lines are still checking IsNumber
or IsLetter
exactly like before. So I'm not sure if this actually did anything to allow -
?
Description
This was seemingly fixed in #9570 last year, and looking at the code it doesn't look like the code regressed, but I can't seem to include environment variables with a
-
in them viaenv_file
in a compose file.Steps To Reproduce
foo.env
contains (hello ASP.NET config env vars):docker-compose.yaml
contains:trying to do
up
errors out with:(I'm also a little confused why it prints the entire line as "variable name" but I think that's just a printing issue?)
I can define variables with a - in them fine directly in
environment:
entries in the compose file.Compose Version
Docker Environment
Anything else?
No response