Fix config.py

This commit is contained in:
nothink 2018-07-26 01:28:12 +09:00
parent a8e00eae82
commit 113410fc2d
2 changed files with 4 additions and 3 deletions

View file

@ -33,7 +33,6 @@ matrix:
- pip install -r requirements.txt - pip install -r requirements.txt
- pip install -r dev-requirements.txt - pip install -r dev-requirements.txt
script: script:
- python -c "import os; print('CI') if os.getenv('CI') == 'true' else 'unknown'"
- pycodestyle wait-for-es - pycodestyle wait-for-es
- pycodestyle generate-thumb - pycodestyle generate-thumb
- pycodestyle szurubooru/ - pycodestyle szurubooru/

View file

@ -17,6 +17,8 @@ def merge(left: Dict, right: Dict) -> Dict:
def docker_config() -> Dict: def docker_config() -> Dict:
if os.getenv('CI') == 'true':
return {}
for key in [ for key in [
'POSTGRES_USER', 'POSTGRES_USER',
'POSTGRES_PASSWORD', 'POSTGRES_PASSWORD',
@ -51,8 +53,8 @@ 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.path.exists('/.dockerenv') and os.getenv('CI', '') != 'true': if os.path.exists('/.dockerenv'):
# ret = merge(ret, docker_config()) ret = merge(ret, docker_config())
return ret return ret