Sep 16 - Optimize code, part 1
This commit is contained in:
@@ -83,6 +83,17 @@ class Config:
|
||||
os.environ.get('VERIFICATION_PHOTO_MAX_SIZE', str(5 * 1024 * 1024))
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Request size limits
|
||||
# ------------------------------------------------------------------ #
|
||||
# Flask 3.1 rejects any non-file form field larger than MAX_FORM_MEMORY_SIZE
|
||||
# (default 500 KB) with HTTP 413. The verification photo is sent as a base64
|
||||
# TEXT field, so this follows the photo limit (+1 MB for the other fields).
|
||||
MAX_FORM_MEMORY_SIZE = VERIFICATION_PHOTO_MAX_SIZE + 1024 * 1024
|
||||
# Whole-request cap (Excel imports, photos). Nginx client_max_body_size
|
||||
# must be at least this, or Nginx rejects larger uploads first.
|
||||
MAX_CONTENT_LENGTH = int(os.environ.get('MAX_UPLOAD_SIZE_MB', '50')) * 1024 * 1024
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Check-in interval
|
||||
# ------------------------------------------------------------------ #
|
||||
@@ -106,6 +117,15 @@ class Config:
|
||||
FLASK_PORT = int(os.environ.get('FLASK_PORT', '5000'))
|
||||
THREADED = os.environ.get('THREADED', 'True').lower() == 'true'
|
||||
|
||||
# Number of reverse proxies in front of the app (Nginx = 1; Cloudflare in
|
||||
# front of Nginx = 2). ProxyFix reads the real client IP from that many
|
||||
# X-Forwarded-For hops. 0 = not behind a proxy (local development only).
|
||||
TRUSTED_PROXY_COUNT = int(os.environ.get('TRUSTED_PROXY_COUNT', '1'))
|
||||
|
||||
# Public base URL of this deployment (e.g. https://qr.govservicesinc.com).
|
||||
# Used for QR images generated at startup, where there is no request.
|
||||
QR_BASE_URL = os.environ.get('QR_BASE_URL', '').strip()
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Default admin (used only on first boot)
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
Reference in New Issue
Block a user