Allow to set fallback secret keys (#4482)

This commit is contained in:
Raphael Michel
2024-10-07 16:31:24 +02:00
committed by GitHub
parent 1334a570e4
commit cdc5401dc2
2 changed files with 11 additions and 0 deletions

View File

@@ -294,6 +294,10 @@ Example::
setting is not provided, pretix will generate a random secret on the first start setting is not provided, pretix will generate a random secret on the first start
and will store it in the filesystem for later usage. and will store it in the filesystem for later usage.
``secret_fallback0`` ... ``secret_fallback9``
Prior versions of the secret to be used by Django for signing and verification purposes that will still
be accepted but no longer be used for new signing.
``debug`` ``debug``
Whether or not to run in debug mode. Default is ``False``. Whether or not to run in debug mode. Default is ``False``.

View File

@@ -94,6 +94,13 @@ else:
pass # os.chown is not available on Windows pass # os.chown is not available on Windows
f.write(SECRET_KEY) f.write(SECRET_KEY)
SECRET_KEY_FALLBACKS = []
for i in range(10):
if config.has_option('django', f'secret_fallback{i}'):
SECRET_KEY_FALLBACKS.append(config.get('django', f'secret_fallback{i}'))
# Adjustable settings # Adjustable settings
debug_fallback = "runserver" in sys.argv or "runserver_plus" in sys.argv debug_fallback = "runserver" in sys.argv or "runserver_plus" in sys.argv