Skip to content

Commit 139b228

Browse files
authored
Update constants.js
1 parent 57269ec commit 139b228

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/constants.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ export const DECODED_ROUTES = {
5252
],
5353
};
5454

55-
export const UPLOAD_FILE_MAX_SIZE = 20 * 1024 * 1024; // 20mb
55+
// FilesUpload page - Default max size: 20MB else use env override if exists and valid number
56+
const DEFAULT_UPLOAD_FILE_MAX_SIZE = 20 * 1024 * 1024;
57+
const overrideMaxFileSizeMB = parseInt(process.env.OVERRIDE_UPLOAD_FILE_MAX_SIZE_IN_MB, 10);
58+
const computedUploadFileMaxSize = (
59+
!isNaN(overrideMaxFileSizeMB) && overrideMaxFileSizeMB > 0
60+
? overrideMaxFileSizeMB * 1024 * 1024
61+
: DEFAULT_UPLOAD_FILE_MAX_SIZE
62+
);
63+
export const UPLOAD_FILE_MAX_SIZE = computedUploadFileMaxSize;
5664

5765
export const COURSE_BLOCK_NAMES = ({
5866
chapter: { id: 'chapter', name: 'Section' },

0 commit comments

Comments
 (0)