DeepBlue/util/config.py

24 lines
532 B
Python
Raw Permalink Normal View History

2020-01-08 01:26:36 +00:00
'''
This module loads settings. Right now
it can only hold one config file at a time
'''
2020-01-08 01:08:07 +00:00
import json
from util import logging
filepath = ""
settings = {}
2020-01-08 01:26:36 +00:00
def load(file : str) -> bool:
2020-01-08 01:08:07 +00:00
global settings
filepath = file
try:
with open(file, "r") as sett_file:
settings = json.load(sett_file)
logging.info(f"Trying {filepath}.....Success!")
return True
except Exception as e:
logging.info(f"Trying {filepath}.....Failed!")
logging.error(str(e))
return False