fix: Protect against exports larger than memory/max

This commit is contained in:
Tom Moor
2023-09-02 22:11:53 -04:00
parent 0054b7152e
commit 093ee74a90
3 changed files with 65 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ require("dotenv").config({
silent: true,
});
import os from "os";
import {
validate,
IsNotEmpty,
@@ -622,6 +623,14 @@ export class Environment {
this.AWS_S3_UPLOAD_MAX_SIZE
);
/**
* Limit on export size in bytes. Defaults to the total memory available to
* the container.
*/
@IsNumber()
public MAXIMUM_EXPORT_SIZE =
this.toOptionalNumber(process.env.MAXIMUM_EXPORT_SIZE) ?? os.totalmem();
/**
* Iframely url
*/