- main.py / metering.py: try the HD (bgutil/720p) strategy first, fall back to the conservative (360p) clients on any failure, so a YouTube/yt-dlp change degrades gracefully instead of failing the whole job. - cloud/alerts.py: in-memory tracking of managed-job outcomes; emails the admin (ADMIN_EMAIL) when a proxy/credit error appears or when many jobs fail in a row, with a 1h per-alert cooldown. Wired into run_job_wrapper. - Email switched from Resend to SMTP (cloud/emails.py) for magic link + alerts (Namecheap Private Email). Config via SMTP_* / EMAIL_FROM / ADMIN_EMAIL in the mounted .env (kept out of compose so the password's $/* aren't mangled). SMTP send verified from host and from the backend container.
48 lines
1.9 KiB
Text
48 lines
1.9 KiB
Text
# Cloud (paid / managed-keys) mode — env template for openshorts.app.
|
|
# Copy to .env and fill in. Only needed when running with docker-compose.cloud.yml.
|
|
# Self-hosters running plain BYOK do NOT need any of this.
|
|
|
|
BILLING_ENABLED=true
|
|
|
|
# Postgres (docker-compose.cloud.yml provisions the `db` service)
|
|
POSTGRES_PASSWORD=change-me
|
|
DATABASE_URL=postgresql+asyncpg://openshorts:change-me@db:5432/openshorts
|
|
|
|
# Auth
|
|
JWT_SECRET=generate-a-long-random-string
|
|
FRONTEND_URL=https://openshorts.app
|
|
ALLOWED_ORIGINS=https://openshorts.app
|
|
|
|
# Email — magic link + admin alerts, via SMTP (e.g. Namecheap Private Email).
|
|
# Quote the password if it contains $ or * so dotenv keeps it literal.
|
|
SMTP_HOST=mail.privateemail.com
|
|
SMTP_PORT=465
|
|
SMTP_USER=info@yourdomain.com
|
|
SMTP_PASSWORD='your-mailbox-password'
|
|
EMAIL_FROM=OpenShorts <info@yourdomain.com>
|
|
# Operational alerts (proxy out of credits / high failure rate) are emailed here.
|
|
ADMIN_EMAIL=you@example.com
|
|
|
|
# Google OAuth (optional; magic link works without it)
|
|
GOOGLE_CLIENT_ID=
|
|
GOOGLE_CLIENT_SECRET=
|
|
|
|
# Stripe (test keys shown; use live keys in production).
|
|
# Prices are resolved by lookup_key (starter_monthly, topup_60, ...) at runtime,
|
|
# so no price IDs are needed here. Create the prices with those lookup_keys.
|
|
STRIPE_SECRET_KEY=sk_test_...
|
|
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
|
|
# Managed provider keys (server-owned; only handed to entitled paid users)
|
|
MANAGED_GEMINI_API_KEY=
|
|
MANAGED_UPLOAD_POST_API_KEY=
|
|
OPENSHORTS_LOGO_URL=https://openshorts.app/logo.png
|
|
|
|
# Residential proxy for YouTube downloads (avoids datacenter-IP bans on the
|
|
# hosted server). Recommended: DataImpulse (~$1/GB PAYG). Downloads are capped
|
|
# to 720p when this is set, to control bandwidth cost. Empty = direct download.
|
|
PROXY_URL=
|
|
|
|
# PO-token provider for 720p/1080p YouTube (bgutil sidecar in docker-compose.cloud.yml).
|
|
# Defaults to the sidecar; only override if you run bgutil elsewhere.
|
|
BGUTIL_BASE_URL=http://bgutil:4416
|