Make upload limit and Caddy settings configurable via env vars

- API: read the upload size limit from MAX_UPLOAD_MEGABYTES (default 15)
  and keep MAX_UPLOAD_BYTES as the byte value used by /predict
- Caddy: read the ACME email and request body limit from CADDY_EMAIL and
  CADDY_MAX_BODY (default 16MB, ~1 MB above the API limit)
- compose: pass the new variables to caddy_proxy and cnn_api

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-24 19:01:42 +02:00
co-authored by Claude Sonnet 5
parent 79db918564
commit 121d8a8ab4
3 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ QUEUED_INFERENCES = max(0, int(os.getenv("QUEUED_INFERENCES", "1")))
# PyTorch threads used by EACH running prediction. Total CPU use is roughly
# PARALLEL_INFERENCES * TORCH_THREADS, so keep the product <= your CPU cores.
TORCH_THREADS = max(1, int(os.getenv("TORCH_THREADS", "1")))
MAX_UPLOAD_BYTES = 5 * 1024 * 1024
MAX_UPLOAD_BYTES = int(max(1, float(os.getenv("MAX_UPLOAD_MEGABYTES", "15"))) * 1024 * 1024)
MAX_FRAME_BYTES = 1 * 1024 * 1024
MAX_IMAGE_PIXELS = 20_000_000
MAX_WEBSOCKETS = 3