pounce/backend/app/config.py

69 lines
2.0 KiB
Python

"""Application configuration using pydantic-settings."""
from functools import lru_cache
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""Application settings loaded from environment variables."""
# Database
database_url: str = "sqlite+aiosqlite:///./domainwatch.db"
# JWT Settings
secret_key: str = "dev-secret-key-change-in-production"
algorithm: str = "HS256"
access_token_expire_minutes: int = 1440 # 24 hours
# App Settings
app_name: str = "DomainWatch"
debug: bool = True
# Email Settings (optional)
smtp_host: str = ""
smtp_port: int = 587
smtp_user: str = ""
smtp_password: str = ""
email_from: str = ""
# CORS Settings
cors_origins: str = "http://localhost:3000,http://127.0.0.1:3000"
# Scheduler Settings
check_hour: int = 6
check_minute: int = 0
scheduler_check_interval_hours: int = 24
enable_scheduler: bool = False # Run APScheduler jobs in this process (recommend: separate scheduler process)
# =================================
# External API Credentials
# =================================
# DropCatch API (Official Partner API)
# Docs: https://www.dropcatch.com/hiw/dropcatch-api
dropcatch_client_id: str = ""
dropcatch_client_secret: str = ""
dropcatch_api_base: str = "https://api.dropcatch.com"
# Sedo API (Partner API - XML-RPC)
# Docs: https://api.sedo.com/apidocs/v1/
# Find your credentials: Sedo.com → Mein Sedo → API-Zugang
sedo_partner_id: str = ""
sedo_sign_key: str = ""
sedo_api_base: str = "https://api.sedo.com/api/v1/"
# Moz API (SEO Data)
moz_access_id: str = ""
moz_secret_key: str = ""
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
extra = "ignore" # Ignore extra fields in .env
@lru_cache()
def get_settings() -> Settings:
"""Get cached settings instance."""
return Settings()