(backend) allow setting session cookie age via env var

We want to be able to increase the duration of the cookie session
by setting an environment variable.
This commit is contained in:
Samuel Paccoud - DINUM
2025-05-16 20:07:16 +02:00
committed by Manuel Raynaud
parent 6377c8fcca
commit 6e5d005dee
3 changed files with 9 additions and 5 deletions

View File

@@ -10,7 +10,8 @@ and this project adheres to
## Added
- ✨(back) allow theme customnization using a configuration file #948
- ✨(backend) allow setting session cookie age via env var #977
- ✨(backend) allow theme customnization using a configuration file #948
- ✨ Add a custom callout block to the editor #892
- 🚩(frontend) version MIT only #911
- ✨(backend) integrate maleware_detection from django-lasuite #936

View File

@@ -54,6 +54,7 @@ These are the environment variables you can set for the `impress-backend` contai
| CRISP_WEBSITE_ID | crisp website id for support | |
| DJANGO_CELERY_BROKER_URL | celery broker url | redis://redis:6379/0 |
| DJANGO_CELERY_BROKER_TRANSPORT_OPTIONS | celery broker transport options | {} |
| SESSION_COOKIE_AGE | duration of the cookie session | 60*60*12 |
| OIDC_CREATE_USER | create used on OIDC | false |
| OIDC_RP_SIGN_ALGO | verification algorithm used OIDC tokens | RS256 |
| OIDC_RP_CLIENT_ID | client id used for OIDC | impress |

View File

@@ -462,7 +462,9 @@ class Base(Configuration):
# Session
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default"
SESSION_COOKIE_AGE = 60 * 60 * 12
SESSION_COOKIE_AGE = values.PositiveIntegerValue(
default=60 * 60 * 12, environ_name="SESSION_COOKIE_AGE", environ_prefix=None
)
# OIDC - Authorization Code Flow
OIDC_CREATE_USER = values.BooleanValue(