1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Administrator-py/bot_bde/config.py

21 lines
506 B
Python
Raw Permalink Normal View History

2020-04-08 17:11:23 +02:00
from bot_bde.logger import logger
from os.path import isfile
from json import load
logger = logger.getChild("Config")
if not isfile("config.json"):
logger.critical("Config file not found !")
exit(1)
config = {}
with open("config.json") as conf:
logger.info("Loading configuration")
try:
config.update(load(conf))
except Exception as e:
logger.critical(f"Fail to load configuration: {e}")
exit(1)
else:
logger.info("Configuration load successful")