import json # The parsed config object __CONFIG = {} def load(filename: str) -> None: """ Load a JSON-formatted configuration file. :param filename: The config file to load. """ global __CONFIG # Open and parse the JSON config file with open(filename, 'r') as conf: __CONFIG = json.load(conf) def get() -> dict: """ Return the current configuration. """ global __CONFIG return __CONFIG def get_plugin_config(name: str): """ Return a plugin's configuration under .plugins[name] :param name: The plugin name. """ global __CONFIG return __CONFIG.get('plugins', {}).get(name, {})