From 4a9d69e16912b74c9017dcf610dff69fc43533b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adeodato=20Sim=C3=B3?= Date: Wed, 24 Jan 2024 20:13:32 +0100 Subject: [PATCH] Support DATA_UPLOAD_MAX_MEMORY_MiB, only, in .env Since arithmetic is not allowed in .env files, a change in unit for the variable seems most usable. --- .env.example | 10 +++++----- bookwyrm/settings.py | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index c77d0b604..1bf6d5406 100644 --- a/.env.example +++ b/.env.example @@ -138,9 +138,9 @@ TWO_FACTOR_LOGIN_MAX_SECONDS=60 # Value should be a comma-separated list of host names. CSP_ADDITIONAL_HOSTS= -# Increase if users are having trouble uploading BookWyrm export files. -# Default value is 100MB -DATA_UPLOAD_MAX_MEMORY_SIZE=104857600 - # Time before being logged out (in seconds) -# SESSION_COOKIE_AGE=2592000 # current default: 30 days \ No newline at end of file +# SESSION_COOKIE_AGE=2592000 # current default: 30 days + +# Maximum allowed memory for file uploads (increase if users are having trouble +# uploading BookWyrm export files). +# DATA_UPLOAD_MAX_MEMORY_MiB=100 diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 8e6252945..724fad16d 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -446,4 +446,6 @@ if HTTP_X_FORWARDED_PROTO: # user with the same username - in which case you should change it! INSTANCE_ACTOR_USERNAME = "bookwyrm.instance.actor" -DATA_UPLOAD_MAX_MEMORY_SIZE = env.int("DATA_UPLOAD_MAX_MEMORY_SIZE", 104857600) +# We only allow specifying DATA_UPLOAD_MAX_MEMORY_SIZE in MiB from .env +# (note the difference in variable names). +DATA_UPLOAD_MAX_MEMORY_SIZE = env.int("DATA_UPLOAD_MAX_MEMORY_MiB", 100) << 20