import toml def load_config (toml_file): with open(toml_file, 'r') as f: config = toml.load(f) return config CONFIG = load_config("config.toml") API_HOST : str = CONFIG.get("api", {}).get("host", "0.0.0.0") API_PORT : int = CONFIG.get("api", {}).get("port", 8000) DATABASE_HOST : str = CONFIG.get("database", {}).get("host", "localhost") DATABASE_PORT : int = CONFIG.get("database", {}).get("port", 3306) DATABASE_USER : str = CONFIG.get("database", {}).get("user", "root") DATABASE_PASSWORD : str = CONFIG.get("database", {}).get("password", "root") def load_common_config (): return { "minSpeed": CONFIG.get("common", {}).get("minSpeed", 15), "maxSpeed": CONFIG.get("common", {}).get("maxSpeed", 50), "avgSpeed": CONFIG.get("common", {}).get("avgSpeed", 19), "minRate": CONFIG.get("common", {}).get("minRate", 0.1), "numres": CONFIG.get("common", {}).get("numres", 10) }