26 lines
448 B
Python
26 lines
448 B
Python
|
|
||
|
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
|