"""TOML-backed application configuration singleton and re-export helpers.""" from __future__ import annotations from app.core.app_config_loader import load_app_config from app.core.app_config_models import ( AgentLogConfig, AlembicConfig, AppConfig, AsrConfig, CeleryConfig, ChatConfig, DeployConfig, EvalConfig, LlmConfig, MemoirConfig, MemoryConfig, MiscConfig, OtelConfig, StoryConfig, TtsConfig, ) from app.core.config import settings as _bootstrap_settings _app_config: AppConfig | None = None def get_app_config() -> AppConfig: global _app_config if _app_config is None: _app_config = load_app_config(_bootstrap_settings.app_environment) return _app_config def reload_app_config(*, app_environment: str | None = None) -> AppConfig: """Reload TOML config (tests).""" global _app_config env = app_environment or _bootstrap_settings.app_environment _app_config = load_app_config(env) return _app_config class _LazyAppConfig: def __getattr__(self, name: str): return getattr(get_app_config(), name) app_config: AppConfig | _LazyAppConfig = _LazyAppConfig() __all__ = [ "AgentLogConfig", "AlembicConfig", "AppConfig", "AsrConfig", "CeleryConfig", "ChatConfig", "DeployConfig", "EvalConfig", "LlmConfig", "MemoirConfig", "MemoryConfig", "MiscConfig", "OtelConfig", "StoryConfig", "TtsConfig", "app_config", "get_app_config", "reload_app_config", ]