Download apps/api/mbf/config.py from Sandy-sys/finai: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/spaces/Sandy-sys/finai/resolve/main/apps/api/mbf/config.py
- Command line
-
hf download hf://spaces/Sandy-sys/finai/apps/api/mbf/config.py
-
curl -L -o config.py https://huggingface.co/spaces/Sandy-sys/finai/resolve/main/apps/api/mbf/config.py
1.75 kB
| """Centralized config loaded from .env.local.""" | |
| from __future__ import annotations | |
| from functools import lru_cache | |
| from pathlib import Path | |
| from pydantic_settings import BaseSettings, SettingsConfigDict | |
| ROOT = Path(__file__).resolve().parents[3] | |
| class Settings(BaseSettings): | |
| model_config = SettingsConfigDict( | |
| env_file=str(ROOT / ".env.local"), | |
| env_file_encoding="utf-8", | |
| extra="ignore", | |
| ) | |
| # LLM (Groq) | |
| deepseek_base_url: str = "https://api.groq.com/openai/v1" | |
| deepseek_chat_model: str = "llama-3.3-70b-versatile" | |
| deepseek_reasoner_model: str = "llama-3.3-70b-versatile" | |
| # MySQL | |
| mysql_host: str = "127.0.0.1" | |
| mysql_port: int = 3307 | |
| mysql_database: str = "magicbusDB" | |
| mysql_ro_user: str = "mbf_ro" | |
| mysql_ro_password: str = "" | |
| # Postgres | |
| pg_host: str = "127.0.0.1" | |
| pg_port: int = 5433 | |
| pg_database: str = "mbf_pg" | |
| pg_user: str = "mbf" | |
| pg_password: str = "" | |
| redis_url: str = "redis://127.0.0.1:6380/0" | |
| api_host: str = "127.0.0.1" | |
| api_port: int = 8000 | |
| duckdb_path: str = str(ROOT / "data" / "mbf.duckdb") | |
| schema_path: str = str(ROOT / "data" / "schema.json") | |
| def mysql_ro_url(self) -> str: | |
| return ( | |
| f"mysql+pymysql://{self.mysql_ro_user}:{self.mysql_ro_password}" | |
| f"@{self.mysql_host}:{self.mysql_port}/{self.mysql_database}" | |
| ) | |
| def pg_url(self) -> str: | |
| return ( | |
| f"postgresql+psycopg2://{self.pg_user}:{self.pg_password}" | |
| f"@{self.pg_host}:{self.pg_port}/{self.pg_database}" | |
| ) | |
| def get_settings() -> Settings: | |
| return Settings() | |