pounce/backend/app/config.py
Yves Gugger 99ccfbd23f
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
fix: Add site_url to config for yield activation
2025-12-14 21:52:59 +01:00

87 lines
2.5 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
site_url: str = "https://pounce.ch" # Base URL for links in emails/API responses
# 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)
# Job Queue / Redis (Phase 2)
redis_url: str = "" # e.g. redis://redis:6379/0
enable_job_queue: bool = False
# Observability (Phase 2)
enable_metrics: bool = True
metrics_path: str = "/metrics"
enable_db_query_metrics: bool = False
# Rate limiting storage (SlowAPI / limits). Use Redis in production.
rate_limit_storage_uri: str = "memory://"
# Database pooling (PostgreSQL)
db_pool_size: int = 5
db_max_overflow: int = 10
db_pool_timeout: int = 30
# =================================
# 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()