clipwright/.env.cloud.example
juancarlos.cavero 0ba4fac47b feat: durable video library on Cloudflare R2 (history + retention)
- cloud/storage.py: R2 (S3-compatible) client — upload, presigned view/download
  URLs, delete-by-prefix.
- cloud/videos.py: archive a completed managed job's clips to R2 under
  users/<uid>/<job>/, GET /api/history (private signed links), and a retention
  sweeper that deletes a user's videos 7 days after their subscription ends.
- models.py: user_videos table (created via create_all).
- app.py: archive clips to R2 on managed-job completion.
- billing.py: email the admin the moment a subscriber hits cancel.
- Frontend: History tab (library grid with per-video view + download).

R2 bucket 'openshorts-videos' + scoped API token created; end-to-end verified:
archive -> presigned GET (200) -> purge after grace -> object 404.
2026-07-14 14:56:40 +02:00

55 lines
2.2 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=
# Cloudflare R2 (S3-compatible) — durable storage for users' generated videos.
# Create an R2 bucket + an "Object Read & Write" API token scoped to it.
R2_ENDPOINT=https://<account_id>.r2.cloudflarestorage.com
R2_BUCKET=openshorts-videos
R2_ACCESS_KEY_ID=
R2_SECRET_ACCESS_KEY=
# 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