Fixes #636: env-file shall be resolved relative to the CWD

Signed-off-by: BugFest <bugfest.dev@pm.me>
This commit is contained in:
BugFest
2023-04-07 22:03:28 +02:00
committed by Muayyad Alsadi
parent 620f5d7473
commit 59a59c1a3a
4 changed files with 25 additions and 4 deletions

View File

@ -1526,11 +1526,13 @@ class PodmanCompose:
dirname = os.path.realpath(os.path.dirname(filename))
dir_basename = os.path.basename(dirname)
self.dirname = dirname
# TODO: remove next line
os.chdir(dirname)
dotenv_path = os.path.join(dirname, args.env_file)
dotenv_dict = dotenv_to_dict(dotenv_path)
# env-file is relative to the CWD
dotenv_dict = {}
if args.env_file:
dotenv_path = os.path.realpath(args.env_file)
dotenv_dict = dotenv_to_dict(dotenv_path)
os.environ.update(
{
key: value