spaceapi-server/spaceapi_server/config/__init__.py

26 lines
449 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
2019-12-02 22:32:17 +01:00
return __CONFIG