compose
compose copied to clipboard
Add ability to use toml file instead of .env
Description
It would be great to add the ability to use a toml file instead of a regular .env, because toml provides much more functionality than a regular .env.
e.g.
services:
web:
image: ${toml.services.images}
ports: ${toml.services.ports}
env_file:
- ${toml.services.env}
redis:
image: ${toml.services.images}
TOML example
[services]
[services.web]
image = "nginx"
ports = { 80 = 80, 443 = 443 }
env = {somevar1 = someval1, somevar2 = someval2}
[services.redis]
image = "redis"
That's an interesting proposal, some thoughts:
- Compose would need to know about the current service node to resolve
toml.services.images, this is a significant change in the parser - Your example assumes variable can be resolved into an array (see
ports) which is also a major challenge (see https://github.com/docker/compose/issues/4249) we haven't addressed yet
Closing as "not planned" While this is an interesting proposal, this would require a full redesign of the compose file parser For those interested in such a feature, better implement a compose file pre-processor you can combine with Docker Compose.