DANGER: Temporary remove reading docker configs
This commit is contained in:
parent
d4dabb60bf
commit
65bc40613d
1 changed files with 0 additions and 31 deletions
|
@ -16,43 +16,12 @@ def merge(left: Dict, right: Dict) -> Dict:
|
||||||
return left
|
return left
|
||||||
|
|
||||||
|
|
||||||
def docker_config() -> Dict:
|
|
||||||
for key in [
|
|
||||||
'POSTGRES_USER',
|
|
||||||
'POSTGRES_PASSWORD',
|
|
||||||
'POSTGRES_HOST',
|
|
||||||
'ESEARCH_HOST'
|
|
||||||
]:
|
|
||||||
if not os.getenv(key, False):
|
|
||||||
raise errors.ConfigError(f'Environment variable "{key}" not set')
|
|
||||||
return {
|
|
||||||
'debug': True,
|
|
||||||
'show_sql': int(os.getenv('LOG_SQL', 0)),
|
|
||||||
'data_url': os.getenv('DATA_URL', '/data/'),
|
|
||||||
'data_dir': '/data/',
|
|
||||||
'database': 'postgres://%(user)s:%(pass)s@%(host)s:%(port)d/%(db)s' % {
|
|
||||||
'user': os.getenv('POSTGRES_USER'),
|
|
||||||
'pass': os.getenv('POSTGRES_PASSWORD'),
|
|
||||||
'host': os.getenv('POSTGRES_HOST'),
|
|
||||||
'port': int(os.getenv('POSTGRES_PORT', 5432)),
|
|
||||||
'db': os.getenv('POSTGRES_DB', os.getenv('POSTGRES_USER'))
|
|
||||||
},
|
|
||||||
'elasticsearch': {
|
|
||||||
'host': os.getenv('ESEARCH_HOST'),
|
|
||||||
'port': int(os.getenv('ESEARCH_PORT', 9200)),
|
|
||||||
'index': os.getenv('ESEARCH_INDEX', 'szurubooru')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def read_config() -> Dict:
|
def read_config() -> Dict:
|
||||||
with open('../config.yaml.dist') as handle:
|
with open('../config.yaml.dist') as handle:
|
||||||
ret = yaml.load(handle.read())
|
ret = yaml.load(handle.read())
|
||||||
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'):
|
|
||||||
# ret = merge(ret, docker_config())
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue