Edm0nd/edmond/config.py

11 lines
310 B
Python
Raw Normal View History

2020-10-08 18:46:45 +02:00
import json
def load_config(config_path: str, logger=None) -> dict:
2020-10-08 18:46:45 +02:00
try:
with open(config_path, "rt") as config_file:
return json.load(config_file)
except (OSError, json.decoder.JSONDecodeError) as exc:
2020-10-08 18:46:45 +02:00
logger.critical(f"Could not load config file: {exc}")
exit()