From 1b558cf912308f494077e1a0a2d5ef3102ea4770 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 24 Oct 2023 18:50:23 +0200 Subject: [PATCH] Promote Flasks `MAX_CONTENT_LENGTH` config to datalab setting to force setting; make default 100 GB --- pydatalab/pydatalab/config.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pydatalab/pydatalab/config.py b/pydatalab/pydatalab/config.py index 48558c32f..e3fd3f3e4 100644 --- a/pydatalab/pydatalab/config.py +++ b/pydatalab/pydatalab/config.py @@ -115,6 +115,15 @@ class ServerConfig(BaseSettings): None, description="A dictionary containing metadata to serve at `/info`." ) + MAX_CONTENT_LENGTH: int = Field( + 100 * 1000 * 1000, + description=r"""Direct mapping to the equivalent Flask setting. In practice, limits the file size that can be uploaded. +Defaults to 100 GB to avoid filling the tmp directory of a server. + +Warning: this value will overwrite any other values passed to `FLASK_MAX_CONTENT_LENGTH` but is included here to clarify +its importance when deploying a datalab instance.""", + ) + @root_validator def validate_cache_ages(cls, values): if values.get("REMOTE_CACHE_MIN_AGE") > values.get("REMOTE_CACHE_MAX_AGE"):