spaceapi-server/spaceapi_server/config/__init__.py
2021-05-30 17:52:25 +02:00

25 lines
454 B
Python

import yaml
# The parsed config object
__CONFIG = {}
def load(filename: str) -> None:
"""
Load a YAML-formatted configuration file.
:param filename: The config file to load.
"""
global __CONFIG
# Open and parse the YAML config file
with open(filename, 'r') as conf:
__CONFIG = yaml.safe_load(conf)
def get() -> dict:
"""
Return the current configuration.
"""
global __CONFIG
return __CONFIG