Fix config.py

This commit is contained in:
nothink 2018-07-26 01:53:52 +09:00
parent 8837fe6b92
commit a8adcf6538

View file

@ -23,7 +23,7 @@ def docker_config() -> Dict:
'POSTGRES_HOST', 'POSTGRES_HOST',
'ESEARCH_HOST' 'ESEARCH_HOST'
]: ]:
if not os.getenv(key, False): if not os.getenv(key, False) and if os.getenv('CI') != 'true':
raise errors.ConfigError(f'Environment variable "{key}" not set') raise errors.ConfigError(f'Environment variable "{key}" not set')
return { return {
'debug': True, 'debug': True,
@ -51,9 +51,7 @@ def read_config() -> Dict:
if os.path.exists('../config.yaml'): if os.path.exists('../config.yaml'):
with open('../config.yaml') as handle: with open('../config.yaml') as handle:
ret = merge(ret, yaml.load(handle.read())) ret = merge(ret, yaml.load(handle.read()))
if os.getenv('CI') == 'true': elif os.path.exists('/.dockerenv') and if os.getenv('CI') != 'true':
pass
elif os.path.exists('/.dockerenv'):
ret = merge(ret, docker_config()) ret = merge(ret, docker_config())
return ret return ret