Extract get_env_files()

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-01-28 16:13:34 -05:00
parent 6c45b6ccdb
commit dfc6206d0d
1 changed files with 9 additions and 6 deletions

View File

@ -617,15 +617,18 @@ def split_port(port):
return internal_port, (external_ip, external_port or None) return internal_port, (external_ip, external_port or None)
def get_env_files(options):
env_files = options.get('env_file', [])
if not isinstance(env_files, list):
env_files = [env_files]
return env_files
def merge_environment(options): def merge_environment(options):
env = {} env = {}
if 'env_file' in options: for f in get_env_files(options):
if isinstance(options['env_file'], list): env.update(env_vars_from_file(f))
for f in options['env_file']:
env.update(env_vars_from_file(f))
else:
env.update(env_vars_from_file(options['env_file']))
if 'environment' in options: if 'environment' in options:
if isinstance(options['environment'], list): if isinstance(options['environment'], list):