Merge pull request #4588 from shin-/hholst80-feature/compose-file-separator

Add environment variable to configure custom path separator when parsing COMPOSE_FILE entry
This commit is contained in:
Joffrey F 2017-03-09 15:35:44 -08:00 committed by GitHub
commit 7675553533
2 changed files with 11 additions and 1 deletions

View File

@ -54,7 +54,8 @@ def get_config_path_from_options(base_dir, options, environment):
config_files = environment.get('COMPOSE_FILE')
if config_files:
return config_files.split(os.pathsep)
pathsep = environment.get('COMPOSE_PATH_SEPARATOR', os.pathsep)
return config_files.split(pathsep)
return None

View File

@ -45,6 +45,15 @@ class TestGetConfigPathFromOptions(object):
'.', {}, environment
) == ['one.yml', 'two.yml']
def test_multiple_path_from_env_custom_separator(self):
with mock.patch.dict(os.environ):
os.environ['COMPOSE_PATH_SEPARATOR'] = '^'
os.environ['COMPOSE_FILE'] = 'c:\\one.yml^.\\semi;colon.yml'
environment = Environment.from_env_file('.')
assert get_config_path_from_options(
'.', {}, environment
) == ['c:\\one.yml', '.\\semi;colon.yml']
def test_no_path(self):
environment = Environment.from_env_file('.')
assert not get_config_path_from_options('.', {}, environment)