Jul 14 - Using CDN - Phase 2a

This commit is contained in:
2026-07-14 12:34:28 -04:00
parent bab564c23e
commit 9edece2726
6 changed files with 140 additions and 24 deletions
+11
View File
@@ -42,6 +42,17 @@ class Config:
# 's3' = Cloudflare R2 / S3-compatible (added Phase 2). Flip via env only.
STORAGE_BACKEND = os.environ.get('STORAGE_BACKEND', 'local')
# Cloudflare R2 — only used when STORAGE_BACKEND=s3.
R2_ENDPOINT_URL = os.environ.get('R2_ENDPOINT_URL')
R2_ACCESS_KEY_ID = os.environ.get('R2_ACCESS_KEY_ID')
R2_SECRET_ACCESS_KEY = os.environ.get('R2_SECRET_ACCESS_KEY')
R2_BUCKET = os.environ.get('R2_BUCKET')
R2_PRESIGN_TTL = int(os.environ.get('R2_PRESIGN_TTL', '86400')) # seconds (24h)
# When true, media_url HEADs the object and falls back to a local static URL
# if it's missing (belt-and-suspenders during an early/partial cutover).
# Off by default — cutover is gated on full verification, so objects exist.
R2_MEDIA_FALLBACK = os.environ.get('R2_MEDIA_FALLBACK', 'false').lower() == 'true'
# ── Session / cookies ───────────────────────────────────────────────────
PERMANENT_SESSION_LIFETIME = timedelta(hours=24)
# Secure by default — subclasses must explicitly opt out for local dev.