From 991c0da25a3a4350724b73cc241757c0dfaa5a3e Mon Sep 17 00:00:00 2001 From: a10kiloham <295361+a10kiloham@users.noreply.github.com> Date: Wed, 29 Jul 2026 03:36:14 +0200 Subject: [PATCH] Use environment variable for maxFileSize (#233) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- server/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/config.js b/server/config.js index 3611fd1..ba1816e 100644 --- a/server/config.js +++ b/server/config.js @@ -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