Use environment variable for maxFileSize (#233)

Thanks — the hard-coded 500MB cap was genuinely too low for video, and making it configurable is the right call.

Merging as-is for the credit; a follow-up commit fixes two things this needs to actually work:

1. `process.env.MAX_FILE_SIZE` is a string, so the value reached multer as text rather than a number — the line directly above uses `parseInt()` for the same reason.
2. Raising it alone is not enough behind a reverse proxy. nginx caps request bodies at `client_max_body_size` (500M on our own deployment) and returns 413 before the app sees the upload, and Cloudflare's own cap applies too. That is now documented in the README alongside the variable.

The follow-up also accepts a suffix (`MAX_FILE_SIZE=2GB`) since typing the byte count is easy to get wrong.
This commit is contained in:
a10kiloham 2026-07-29 03:36:14 +02:00 committed by GitHub
parent 3e3d0081fe
commit 991c0da25a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -59,7 +59,7 @@ module.exports = {
// #148 Item 4: TCP SO_KEEPALIVE idle delay — OS-level dead-peer probing independent of the
// app ping, so a half-open TCP can't persist indefinitely.
tcpKeepAliveMs: parseInt(process.env.TCP_KEEPALIVE_MS) || 20000,
maxFileSize: 500 * 1024 * 1024, // 500MB
maxFileSize: process.env.MAX_FILE_SIZE || 500 * 1024 * 1024, // 500MB
thumbnailWidth: 320,
screenshotQuality: 70,
// SSL: drop your Cloudflare Origin cert + key in certs/ folder