From cb93aad7e6a578d5f5711a0c79e287e77047de57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Juh=C3=A1s?= <xjuhas@fi.muni.cz> Date: Wed, 14 Aug 2024 14:37:58 +0200 Subject: [PATCH] feat: add INJECT_MAX_UPLOAD_SIZE env variable No API changes Closes #242 --- INSTALLATION.md | 1 + ttxbackend/settings.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/INSTALLATION.md b/INSTALLATION.md index d7a1cda2..ed7d5cb3 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -15,6 +15,7 @@ Boolean type variables use consider `true` and `yes` as truthy, and `false` and - `INJECT_DOMAIN`: _string, default=""_ - Domain where yours instance of the INJECT is available. - `INJECT_SECRET_KEY`: _string_ - Used to provide cryptographic signing. Must be at least 50 long characters string. - `INJECT_EMAIL_TIMEOUT`: _int, default=10_ - Specifies a timeout in seconds for blocking operations like the connection attempt to SMTP. +- `INJECT_MAX_UPLOAD_SIZE`: _int, default=10MB_ - Specifies the maximum body size of requests, including file uploads. diff --git a/ttxbackend/settings.py b/ttxbackend/settings.py index 42960646..a91804f6 100644 --- a/ttxbackend/settings.py +++ b/ttxbackend/settings.py @@ -205,6 +205,9 @@ LOG_STORAGE = os.path.join(DATA_STORAGE, "logs") EXPORT_IMPORT_STORAGE = os.path.join(DATA_STORAGE, "export_import") DB_EXPORT_FILE_NAME = "db.json" UPDATE_INTERVAL = 10 +DATA_UPLOAD_MAX_MEMORY_SIZE = int( + os.environ.get("INJECT_MAX_UPLOAD_SIZE", 10 * 2**20) # 10MB +) # Use nose to run all tests TEST_RUNNER = "django_nose.NoseTestSuiteRunner" -- GitLab