2026-06-11 01:01:37 +02:00
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
|
|
|
|
|
|
app_name: str = "Subfeed"
|
|
|
|
|
|
|
|
|
|
database_url: str = "postgresql+psycopg://subfeed:subfeed@db:5432/subfeed"
|
|
|
|
|
|
|
|
|
|
# Session cookie signing key.
|
|
|
|
|
secret_key: str = "change-me-session-key"
|
|
|
|
|
# Fernet key (urlsafe base64, 32 bytes) for encrypting stored refresh tokens.
|
|
|
|
|
token_encryption_key: str = ""
|
|
|
|
|
|
|
|
|
|
google_client_id: str = ""
|
|
|
|
|
google_client_secret: str = ""
|
|
|
|
|
oauth_redirect_url: str = "http://localhost:8080/auth/callback"
|
|
|
|
|
|
|
|
|
|
# Comma-separated invite list / admin list of Google account emails.
|
|
|
|
|
allowed_emails: str = ""
|
|
|
|
|
admin_emails: str = ""
|
|
|
|
|
|
|
|
|
|
# Origin of a separately served frontend dev server (enables CORS). Empty in production.
|
|
|
|
|
frontend_origin: str = ""
|
|
|
|
|
|
2026-06-11 01:22:07 +02:00
|
|
|
# --- Sync / YouTube Data API ---
|
|
|
|
|
# Optional API key for public reads (channels/videos/playlistItems). When set it is
|
|
|
|
|
# preferred for shared backfill/enrichment so it doesn't depend on a specific user.
|
|
|
|
|
youtube_api_key: str = ""
|
|
|
|
|
# Daily quota budget (units). Default leaves headroom under the 10,000/day free limit.
|
|
|
|
|
quota_daily_budget: int = 9000
|
|
|
|
|
# Recent-first backfill: how far back to fetch on the first pass per channel.
|
|
|
|
|
backfill_recent_max_videos: int = 200
|
|
|
|
|
backfill_recent_max_days: int = 365
|
|
|
|
|
|
2026-06-11 01:01:37 +02:00
|
|
|
@property
|
|
|
|
|
def allowed_email_set(self) -> set[str]:
|
|
|
|
|
return {e.strip().lower() for e in self.allowed_emails.split(",") if e.strip()}
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def admin_email_set(self) -> set[str]:
|
|
|
|
|
return {e.strip().lower() for e in self.admin_emails.split(",") if e.strip()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings = Settings()
|