import os import yaml from pathlib import Path class Settings: db = {} logging = {} def __init__(self): home = str(Path.home()) config_file = os.environ.get('CONFIGPATH', f"{home}/.config/opendata_nm/config.yml") with open(f"{config_file}", "r") as stream: try: config = yaml.safe_load(stream) self.db = config["db"] self.logging = config["logging"] except yaml.YAMLError as exc: print(exc)