mirror of
https://github.com/containers/podman-compose.git
synced 2025-08-18 01:20:01 +02:00
Implement environment variable interpolation to YAML dictionary keys
`podman-compose` currently does not support interpolating environment variables in dictionary keys, despite the compose file specification indicating this capability. See the relevant compose-spec documentation: https://github.com/compose-spec/compose-spec/blob/main/12-interpolation.md This feature is useful in `labels` or `environment` sections, where keys can be user-defined strings. To enable interpolation, an alternate equal sign syntax must be used, e.g.: services: foo: labels: - "$VAR_NAME=label_value" After this PR `podman-compose` will align more closely with the compose file specification, allowing for the interpolation of environment variables in dictionary keys. Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
@@ -290,7 +290,7 @@ def rec_subs(value: dict | str | Iterable, subs_dict: dict[str, Any]) -> dict |
|
||||
svc_envs = rec_subs(svc_envs, subs_dict)
|
||||
subs_dict.update(svc_envs)
|
||||
|
||||
value = {k: rec_subs(v, subs_dict) for k, v in value.items()}
|
||||
value = {rec_subs(k, subs_dict): rec_subs(v, subs_dict) for k, v in value.items()}
|
||||
elif isinstance(value, str):
|
||||
|
||||
def convert(m: re.Match) -> str:
|
||||
|
Reference in New Issue
Block a user