Skip to content

Commit

Permalink
Merge pull request #188 from seqeralabs/fix-parsing-env-file
Browse files Browse the repository at this point in the history
fix: parsing of vars in input file with existing env
  • Loading branch information
ejseqera authored Jan 7, 2025
2 parents bb3e095 + b10e586 commit d5e234b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions seqerakit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,16 @@ def main(args=None):
for cli_arg in options.cli_args:
cli_args_list.extend(cli_arg.split())

# add and overwrite existing environment variables with those in the env_file
# Merge environment variables from env_file with existing ones
# Will prioritize env_file values
if options.env_file:
with open(options.env_file, "r") as f:
env_vars = yaml.safe_load(f)
os.environ.update(env_vars)
# Only update environment variables that are explicitly defined in env_file
for key, value in env_vars.items():
if value is not None:
full_value = os.path.expandvars(str(value))
os.environ[key] = full_value

sp = seqeraplatform.SeqeraPlatform(
cli_args=cli_args_list, dryrun=options.dryrun, json=options.json
Expand Down

0 comments on commit d5e234b

Please sign in to comment.