Jul 16 - Fill the gaps between Single-tenant mode and Multi-tenant mode - MT2
This commit is contained in:
@@ -62,6 +62,24 @@ class Config:
|
||||
MAX_CONTENT_LENGTH = 50 * 1024 * 1024 # 50 MB
|
||||
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
|
||||
|
||||
# ── Storage backend (R2 migration, MT-2) ────────────────────────────────
|
||||
# 'local' (default) = files under app/static/uploads, served via url_for('static').
|
||||
# 's3' = Cloudflare R2 / S3-compatible. Flip via env only, per tenant, in MT-8.
|
||||
# Object keys are tenant-prefixed inside the backend; DB paths never change.
|
||||
STORAGE_BACKEND = os.environ.get('STORAGE_BACKEND', 'local')
|
||||
|
||||
# Cloudflare R2 — only used when STORAGE_BACKEND=s3 (inert until MT-8).
|
||||
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 the legacy
|
||||
# unprefixed key, then a local static URL, if it's missing (belt-and-braces
|
||||
# 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.
|
||||
|
||||
Reference in New Issue
Block a user