Skip to content

Commit dfc6206

Browse files
committed
Extract get_env_files()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
1 parent 6c45b6c commit dfc6206

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

compose/service.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -617,15 +617,18 @@ def split_port(port):
617617
return internal_port, (external_ip, external_port or None)
618618

619619

620+
def get_env_files(options):
621+
env_files = options.get('env_file', [])
622+
if not isinstance(env_files, list):
623+
env_files = [env_files]
624+
return env_files
625+
626+
620627
def merge_environment(options):
621628
env = {}
622629

623-
if 'env_file' in options:
624-
if isinstance(options['env_file'], list):
625-
for f in options['env_file']:
626-
env.update(env_vars_from_file(f))
627-
else:
628-
env.update(env_vars_from_file(options['env_file']))
630+
for f in get_env_files(options):
631+
env.update(env_vars_from_file(f))
629632

630633
if 'environment' in options:
631634
if isinstance(options['environment'], list):

0 commit comments

Comments
 (0)