🔧(backend) add FRONTEND_THEME setting
The frontend need to know the theme to be used, so we need to add a new setting to the backend, in order to expose this value to the frontend.
This commit is contained in:
@@ -48,3 +48,6 @@ AI_MODEL=llama
|
|||||||
|
|
||||||
# Collaboration
|
# Collaboration
|
||||||
COLLABORATION_SERVER_URL=ws://localhost:4444
|
COLLABORATION_SERVER_URL=ws://localhost:4444
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
FRONTEND_THEME=dsfr
|
||||||
|
|||||||
@@ -901,8 +901,9 @@ class ConfigView(views.APIView):
|
|||||||
Return a dictionary of public settings.
|
Return a dictionary of public settings.
|
||||||
"""
|
"""
|
||||||
array_settings = [
|
array_settings = [
|
||||||
"ENVIRONMENT",
|
|
||||||
"COLLABORATION_SERVER_URL",
|
"COLLABORATION_SERVER_URL",
|
||||||
|
"ENVIRONMENT",
|
||||||
|
"FRONTEND_THEME",
|
||||||
"MEDIA_BASE_URL",
|
"MEDIA_BASE_URL",
|
||||||
"LANGUAGES",
|
"LANGUAGES",
|
||||||
"LANGUAGE_CODE",
|
"LANGUAGE_CODE",
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ pytestmark = pytest.mark.django_db
|
|||||||
|
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
SENTRY_DSN="https://sentry.test/123",
|
|
||||||
MEDIA_BASE_URL="http://testserver/",
|
|
||||||
COLLABORATION_SERVER_URL="http://testcollab/",
|
COLLABORATION_SERVER_URL="http://testcollab/",
|
||||||
|
FRONTEND_THEME="test-theme",
|
||||||
|
MEDIA_BASE_URL="http://testserver/",
|
||||||
|
SENTRY_DSN="https://sentry.test/123",
|
||||||
)
|
)
|
||||||
def test_api_config_anonymous():
|
def test_api_config_anonymous():
|
||||||
"""Anonymous users should be allowed to get the configuration."""
|
"""Anonymous users should be allowed to get the configuration."""
|
||||||
@@ -27,18 +28,20 @@ def test_api_config_anonymous():
|
|||||||
assert response.status_code == HTTP_200_OK
|
assert response.status_code == HTTP_200_OK
|
||||||
assert response.json() == {
|
assert response.json() == {
|
||||||
"COLLABORATION_SERVER_URL": "http://testcollab/",
|
"COLLABORATION_SERVER_URL": "http://testcollab/",
|
||||||
|
"ENVIRONMENT": "test",
|
||||||
|
"FRONTEND_THEME": "test-theme",
|
||||||
"LANGUAGES": [["en-us", "English"], ["fr-fr", "French"], ["de-de", "German"]],
|
"LANGUAGES": [["en-us", "English"], ["fr-fr", "French"], ["de-de", "German"]],
|
||||||
"LANGUAGE_CODE": "en-us",
|
"LANGUAGE_CODE": "en-us",
|
||||||
"SENTRY_DSN": "https://sentry.test/123",
|
|
||||||
"ENVIRONMENT": "test",
|
|
||||||
"MEDIA_BASE_URL": "http://testserver/",
|
"MEDIA_BASE_URL": "http://testserver/",
|
||||||
|
"SENTRY_DSN": "https://sentry.test/123",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
SENTRY_DSN="https://sentry.test/123",
|
|
||||||
MEDIA_BASE_URL="http://testserver/",
|
|
||||||
COLLABORATION_SERVER_URL="http://testcollab/",
|
COLLABORATION_SERVER_URL="http://testcollab/",
|
||||||
|
FRONTEND_THEME="test-theme",
|
||||||
|
MEDIA_BASE_URL="http://testserver/",
|
||||||
|
SENTRY_DSN="https://sentry.test/123",
|
||||||
)
|
)
|
||||||
def test_api_config_authenticated():
|
def test_api_config_authenticated():
|
||||||
"""Authenticated users should be allowed to get the configuration."""
|
"""Authenticated users should be allowed to get the configuration."""
|
||||||
@@ -51,9 +54,10 @@ def test_api_config_authenticated():
|
|||||||
assert response.status_code == HTTP_200_OK
|
assert response.status_code == HTTP_200_OK
|
||||||
assert response.json() == {
|
assert response.json() == {
|
||||||
"COLLABORATION_SERVER_URL": "http://testcollab/",
|
"COLLABORATION_SERVER_URL": "http://testcollab/",
|
||||||
|
"ENVIRONMENT": "test",
|
||||||
|
"FRONTEND_THEME": "test-theme",
|
||||||
|
"MEDIA_BASE_URL": "http://testserver/",
|
||||||
"LANGUAGES": [["en-us", "English"], ["fr-fr", "French"], ["de-de", "German"]],
|
"LANGUAGES": [["en-us", "English"], ["fr-fr", "French"], ["de-de", "German"]],
|
||||||
"LANGUAGE_CODE": "en-us",
|
"LANGUAGE_CODE": "en-us",
|
||||||
"SENTRY_DSN": "https://sentry.test/123",
|
"SENTRY_DSN": "https://sentry.test/123",
|
||||||
"ENVIRONMENT": "test",
|
|
||||||
"MEDIA_BASE_URL": "http://testserver/",
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -382,6 +382,11 @@ class Base(Configuration):
|
|||||||
None, environ_name="COLLABORATION_SERVER_URL", environ_prefix=None
|
None, environ_name="COLLABORATION_SERVER_URL", environ_prefix=None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
FRONTEND_THEME = values.Value(
|
||||||
|
None, environ_name="FRONTEND_THEME", environ_prefix=None
|
||||||
|
)
|
||||||
|
|
||||||
# Easy thumbnails
|
# Easy thumbnails
|
||||||
THUMBNAIL_EXTENSION = "webp"
|
THUMBNAIL_EXTENSION = "webp"
|
||||||
THUMBNAIL_TRANSPARENCY_EXTENSION = "webp"
|
THUMBNAIL_TRANSPARENCY_EXTENSION = "webp"
|
||||||
|
|||||||
Reference in New Issue
Block a user