Download src/core/config.py from mrmayankmathurorg/Customer-EMAIL-Agent: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/spaces/mrmayankmathurorg/Customer-EMAIL-Agent/resolve/main/src/core/config.py
- Command line
-
hf download hf://spaces/mrmayankmathurorg/Customer-EMAIL-Agent/src/core/config.py
-
curl -L -o config.py https://huggingface.co/spaces/mrmayankmathurorg/Customer-EMAIL-Agent/resolve/main/src/core/config.py
1.56 kB
| """ | |
| Application configuration loaded from environment variables. | |
| """ | |
| from pydantic import model_validator | |
| from pydantic_settings import BaseSettings, SettingsConfigDict | |
| class Settings(BaseSettings): | |
| """Central application settings — loaded from .env file.""" | |
| model_config = SettingsConfigDict( | |
| env_file=".env", | |
| env_file_encoding="utf-8", | |
| extra="ignore", | |
| ) | |
| # --- LLM (OpenAI) --- | |
| OPENAI_API_KEY: str = "" | |
| LLM_BASE_URL: str = "https://api.openai.com/v1" | |
| LLM_MODEL: str = "gpt-6-luna" | |
| EMBEDDING_MODEL: str = "text-embedding-3-small" | |
| # --- Email / IMAP --- | |
| EMAIL_HOST: str = "imap.gmail.com" | |
| EMAIL_PORT: int = 993 | |
| SMTP_HOST: str = "smtp.gmail.com" | |
| SMTP_PORT: int = 587 | |
| EMAIL_USERNAME: str = "" | |
| EMAIL_PASSWORD: str = "" | |
| # --- Persistence (Supabase) --- | |
| SUPABASE_URL: str = "" | |
| SUPABASE_KEY: str = "" | |
| # --- Security --- | |
| # Secret token to protect the backend on public platforms (HF Spaces) | |
| API_TOKEN: str = "" | |
| # --- App --- | |
| APP_ENV: str = "development" | |
| LOG_LEVEL: str = "DEBUG" | |
| def DEBUG(self) -> bool: | |
| return self.APP_ENV == "development" | |
| def require_production_api_token(self) -> "Settings": | |
| """Never start a production backend without an API token.""" | |
| if self.APP_ENV.lower() == "production" and not self.API_TOKEN.strip(): | |
| raise ValueError("API_TOKEN must be configured when APP_ENV=production") | |
| return self | |
| settings = Settings() | |