123456789101112131415161718192021222324252627 |
- # This file serves as a singleton for the configuration settings of the project
- import tomllib
- import os
- import pathlib as pl
- from typing import Any
- def get_config() -> dict[str, Any]:
- """
- Load the configuration file and return the settings as a dictionary.
- """
- match os.getenv("ANN_CONFIG_PATH"):
- case None:
- config_path = pl.Path(__file__).parent.parent / "config.toml"
- case str(path):
- config_path = pl.Path(path)
- if not config_path.exists():
- raise FileNotFoundError(f"Config file not found at {config_path}")
- with open(config_path, "rb") as f:
- config = tomllib.load(f)
- return config
- config = get_config()
|