github-actions[bot]
Automated deployment from GitHub Actions: a9d5a91de63ad7224bafe6039fb2b7479388fbf4
0a8c81b Download src/core/config.py from VLTA-AI/dropshop: direct link, hf CLI and curl.
- Browser
- Download file 2.04 kB
-
https://huggingface.co/spaces/VLTA-AI/dropshop/resolve/main/src/core/config.py
- Command line
-
hf download hf://spaces/VLTA-AI/dropshop/src/core/config.py
-
curl -L -o config.py https://huggingface.co/spaces/VLTA-AI/dropshop/resolve/main/src/core/config.py
2.04 kB
| from pydantic_settings import BaseSettings, SettingsConfigDict | |
| class Settings(BaseSettings): | |
| # App | |
| PROJECT_NAME: str = "VLTA-Dropshopping AI Engine" | |
| # HF | |
| HF_SPACE_URL: str = "" | |
| HF_ACCESS_TOKEN: str = "" | |
| # DB | |
| DATABASE_URL: str = "sqlite:///local.db" | |
| DATABASE_AUTH_TOKEN: str = "" | |
| # AI | |
| OPENAI_BASE_URL: str = "" | |
| OPENAI_API_KEY: str = "" | |
| DEEPSEEK_MODEL: str = "deepseek/deepseek-v4-pro-202606" | |
| # Shopify | |
| SHOPIFY_STORE_DOMAIN: str = "" | |
| SHOPIFY_ADMIN_ACCESS_TOKEN: str = "" | |
| # Telegram | |
| TELEGRAM_BOT_TOKEN: str = "" | |
| # Model Config | |
| model_config = SettingsConfigDict( | |
| env_file=".env", | |
| env_file_encoding="utf-8", | |
| extra="ignore" | |
| ) | |
| def get_sqlalchemy_url(self) -> str: | |
| """Parse database url into a format valid for sqlalchemy-libsql""" | |
| url = self.DATABASE_URL.strip().strip("\"'") | |
| # Format protocol for sqlalchemy-libsql | |
| if "libsql://" in url: | |
| url = url.replace("libsql://", "sqlite+libsql://", 1) | |
| elif "https://" in url: | |
| url = url.replace("https://", "sqlite+libsql://", 1) | |
| elif "wss://" in url: | |
| url = url.replace("wss://", "sqlite+libsql://", 1) | |
| # Ensure Turso cloud URLs use secure connection | |
| if "turso.io" in url and "secure=true" not in url: | |
| if "?" in url: | |
| url += "&secure=true" | |
| else: | |
| url += "?secure=true" | |
| return url | |
| def get_sqlalchemy_connect_args(self) -> dict: | |
| """Parse database connection arguments""" | |
| args = {} | |
| if self.get_sqlalchemy_url.startswith("sqlite://"): | |
| args["check_same_thread"] = False | |
| token = self.DATABASE_AUTH_TOKEN.strip().strip("\"'") | |
| if "sqlite+libsql" in self.get_sqlalchemy_url and token: | |
| args["auth_token"] = token | |
| return args | |
| settings = Settings() | |