mirror of
https://github.com/containers/podman-compose.git
synced 2025-08-18 01:20:01 +02:00
Implement short syntax for env variables in compose.yml "environment:"
This commit allows compose file to directly use environment variable values in "environment:" section when variables were set in `.env` file. This functionality was missing, as docker-compose supports both: short and variable interpolation syntax forms: environment: - FOO and environment: - FOO=${FOO} Relevant docker-compose documentation: https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/ podman-compose is more compatible with docker-compose after this change. Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
@@ -1159,7 +1159,14 @@ async def container_to_args(
|
||||
podman_args.extend(["-e", e])
|
||||
env = norm_as_list(cnt.get("environment", {}))
|
||||
for e in env:
|
||||
podman_args.extend(["-e", e])
|
||||
# new environment variable is set
|
||||
if "=" in e:
|
||||
podman_args.extend(["-e", e])
|
||||
else:
|
||||
# environment variable already exists in environment so pass its value
|
||||
if e in compose.environ.keys():
|
||||
podman_args.extend(["-e", f"{e}={compose.environ[e]}"])
|
||||
|
||||
tmpfs_ls = cnt.get("tmpfs", [])
|
||||
if isinstance(tmpfs_ls, str):
|
||||
tmpfs_ls = [tmpfs_ls]
|
||||
|
Reference in New Issue
Block a user