allow project name to be fetched from dotenv

Look for project name in `self.environ` which includes both `os.environ`
and dotenv variables so that the project name can also be defined in an
environment file.

Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
This commit is contained in:
Kuan-Yi Li 2022-12-01 00:04:32 +08:00 committed by Muayyad Alsadi
parent 252f1d57a5
commit 1cb608d8a7

View File

@ -1541,7 +1541,7 @@ class PodmanCompose:
if project_name is None:
# More strict then actually needed for simplicity: podman requires [a-zA-Z0-9][a-zA-Z0-9_.-]*
project_name = (
os.environ.get("COMPOSE_PROJECT_NAME", None) or dir_basename.lower()
self.environ.get("COMPOSE_PROJECT_NAME", None) or dir_basename.lower()
)
project_name = norm_re.sub("", project_name)
if not project_name: