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/administrator/config.py

21 lines
512 B
Python
Raw Normal View History

from administrator.logger import logger
2020-04-08 17:11:23 +02:00
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")