Spaces:
Runtime error
Runtime error
Download src/backend/core/config.py from HAK-Tech/ciro-backend: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/spaces/HAK-Tech/ciro-backend/resolve/main/src/backend/core/config.py
- Command line
-
hf download hf://spaces/HAK-Tech/ciro-backend/src/backend/core/config.py
-
curl -L -o config.py https://huggingface.co/spaces/HAK-Tech/ciro-backend/resolve/main/src/backend/core/config.py
2.57 kB
| """ | |
| CIRO Backend β Application Configuration | |
| All environment variables are loaded from .env via pydantic-settings. | |
| Import `settings` (the singleton instance), never the class directly. | |
| """ | |
| import os | |
| from pydantic_settings import BaseSettings, SettingsConfigDict | |
| class Settings(BaseSettings): | |
| """Typed, validated application settings loaded from environment variables.""" | |
| model_config = SettingsConfigDict( | |
| env_file=".env", | |
| env_file_encoding="utf-8", | |
| case_sensitive=False, | |
| extra="ignore", | |
| ) | |
| # ββ LLM / Agent Keys βββββββββββββββββββββββββββββββββββββββββββββ | |
| gemini_api_key: str = "" | |
| openai_api_key: str = "" | |
| # ββ Google Maps βββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| google_maps_api_key: str = "" | |
| # ββ Weather βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| openweathermap_api_key: str = "" | |
| # ββ Firebase ββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| firebase_credentials_path: str = "" | |
| # ββ WhatsApp (Meta Cloud API β test mode) βββββββββββββββββββββββββ | |
| whatsapp_token: str = "" | |
| whatsapp_phone_id: str = "" | |
| whatsapp_fire_brigade_number: str = "" | |
| whatsapp_police_number: str = "" | |
| whatsapp_ambulance_number: str = "" | |
| # ββ Application βββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| environment: str = "development" | |
| debug: bool = False | |
| port: int = 8080 | |
| def __init__(self, **kwargs): | |
| super().__init__(**kwargs) | |
| # Bridge pydantic-settings β os.environ for third-party SDKs | |
| # (OpenAI Agents SDK reads OPENAI_API_KEY from os.environ) | |
| if self.openai_api_key and not os.environ.get("OPENAI_API_KEY"): | |
| os.environ["OPENAI_API_KEY"] = self.openai_api_key | |
| if self.gemini_api_key and not os.environ.get("GEMINI_API_KEY"): | |
| os.environ["GEMINI_API_KEY"] = self.gemini_api_key | |
| # Global settings instance β import this, not the class | |
| settings = Settings() | |