Archived
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.
BackupBot/backup_bot/config.py
2020-03-27 16:00:12 +01:00

20 lines
509 B
Python

from backup_bot.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")