From e591d09b009d6b432c7a0c27332976336aeddde2 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 24 Sep 2024 21:43:13 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(backend)=20add=20endpoint=20for=20fro?= =?UTF-8?q?ntend's=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inspired by Joanie. In Frontend context, env variables are only available at build time, not runtime. This is one of the easiest way to pass frontend dynamic configurations while running. This commit only exposes the view already existing. --- src/backend/core/urls.py | 3 ++- src/backend/meet/settings.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/core/urls.py b/src/backend/core/urls.py index f1683a38..f7f0c5a9 100644 --- a/src/backend/core/urls.py +++ b/src/backend/core/urls.py @@ -5,7 +5,7 @@ from django.urls import include, path from rest_framework.routers import DefaultRouter -from core.api import viewsets +from core.api import get_frontend_configuration, viewsets from core.authentication.urls import urlpatterns as oidc_urls # - Main endpoints @@ -23,6 +23,7 @@ urlpatterns = [ [ *router.urls, *oidc_urls, + path("config/", get_frontend_configuration, name="config"), ] ), ), diff --git a/src/backend/meet/settings.py b/src/backend/meet/settings.py index 77201278..692df3f6 100755 --- a/src/backend/meet/settings.py +++ b/src/backend/meet/settings.py @@ -251,6 +251,9 @@ class Base(Configuration): "REDOC_DIST": "SIDECAR", } + # Frontend + FRONTEND_CONFIGURATION = {} + # Mail EMAIL_BACKEND = values.Value("django.core.mail.backends.smtp.EmailBackend") EMAIL_HOST = values.Value(None)