mirror of https://github.com/docker/compose.git
Extract get_env_files()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
6c45b6ccdb
commit
dfc6206d0d
|
@ -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):
|
|
||||||
for f in options['env_file']:
|
|
||||||
env.update(env_vars_from_file(f))
|
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):
|
||||||
|
|
Loading…
Reference in New Issue