diff --git a/agenda/data.py b/agenda/data.py index e9b2b28..36f1ad4 100644 --- a/agenda/data.py +++ b/agenda/data.py @@ -184,8 +184,8 @@ def read_events_yaml(data_dir: str, start: date, end: date) -> list[Event]: return events -async def get_data(now: datetime) -> typing.Mapping[str, str | object]: - """Get data to display on agenda dashboard.""" +def get_config() -> configparser.ConfigParser: + """Load config file.""" config_filename = os.path.join(os.path.dirname(__file__), "..", "config") assert os.path.exists(config_filename) @@ -193,6 +193,13 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]: config = configparser.ConfigParser() config.read(config_filename) + return config + + +async def get_data(now: datetime) -> typing.Mapping[str, str | object]: + """Get data to display on agenda dashboard.""" + config = get_config() + data_dir = config.get("data", "dir") rocket_dir = os.path.join(data_dir, "thespacedevs")