spaceapi-server/spaceapi_server/config/__init__.py

25 lines
448 B
Python
Raw Normal View History

2019-11-25 02:48:12 +01:00
import json
# The parsed config object
__CONFIG = {}
def load(filename: str) -> None:
2019-11-25 03:14:14 +01:00
"""
2019-11-25 02:48:12 +01:00
Load a JSON-formatted configuration file.
2019-11-25 04:10:20 +01:00
:param filename: The config file to load.
2019-11-25 03:14:14 +01:00
"""
2019-11-25 02:48:12 +01:00
global __CONFIG
# Open and parse the JSON config file
with open(filename, 'r') as conf:
__CONFIG = json.load(conf)
def get() -> dict:
2019-11-25 03:14:14 +01:00
"""
2019-11-25 02:48:12 +01:00
Return the current configuration.
2019-11-25 03:14:14 +01:00
"""
2019-11-25 02:48:12 +01:00
global __CONFIG
return __CONFIG