comment-server/lbry_comment_server/settings.py

21 lines
485 B
Python
Raw Normal View History

2019-05-20 11:08:04 +02:00
import json
2019-05-21 12:56:27 +02:00
import logging
2019-05-21 13:54:52 +02:00
import pathlib
2019-05-21 12:56:27 +02:00
logger = logging.getLogger(__name__)
2019-05-20 11:08:04 +02:00
root_dir = pathlib.Path(__file__).parent.parent
config_path = root_dir / 'config' / 'conf.json'
def get_config(filepath):
with open(filepath, 'r') as cfile:
conf = json.load(cfile)
2019-05-21 01:09:07 +02:00
for key, path in conf['PATH'].items():
conf['PATH'][key] = str(root_dir / path)
2019-05-20 11:08:04 +02:00
return conf
config = get_config(config_path)
2019-05-21 12:56:27 +02:00
logger.info('Loaded conf.json: %s', json.dumps(config, indent=4))