Skip to content

Commit 67b69d0

Browse files
AntoLClunika
authored andcommitted
🚩(backend) add homepage feature flag
Add a homepage feature flag that we will propagate to the frontend. It will be used to enable or disable the homepage at runtime.
1 parent f429eb0 commit 67b69d0

File tree

7 files changed

+16
-0
lines changed

7 files changed

+16
-0
lines changed

docs/env.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ These are the environmental variables you can set for the impress-backend contai
4747
| COLLABORATION_API_URL | collaboration api host | |
4848
| COLLABORATION_SERVER_SECRET | collaboration api secret | |
4949
| COLLABORATION_WS_URL | collaboration websocket url | |
50+
| FRONTEND_CSS_URL | To add a external css file to the app | |
51+
| FRONTEND_HOMEPAGE_FEATURE_ENABLED | frontend feature flag to display the homepage | false |
52+
| FRONTEND_FOOTER_FEATURE_ENABLED | frontend feature flag to display the footer | false |
53+
| FRONTEND_FOOTER_VIEW_CACHE_TIMEOUT | Cache duration of the json footer | 86400 |
54+
| FRONTEND_URL_JSON_FOOTER | Url with a json to configure the footer | |
5055
| FRONTEND_THEME | frontend theme to use | |
5156
| POSTHOG_KEY | posthog key for analytics | |
5257
| CRISP_WEBSITE_ID | crisp website id for support | |

env.d/development/common.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ COLLABORATION_WS_URL=ws://localhost:4444/collaboration/ws/
6464

6565
# Frontend
6666
FRONTEND_THEME=default
67+
FRONTEND_HOMEPAGE_FEATURE_ENABLED=True
6768
FRONTEND_FOOTER_FEATURE_ENABLED=True
6869
FRONTEND_URL_JSON_FOOTER=http://frontend:3000/contents/footer-demo.json

src/backend/core/api/viewsets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,7 @@ def get(self, request):
16921692
"CRISP_WEBSITE_ID",
16931693
"ENVIRONMENT",
16941694
"FRONTEND_CSS_URL",
1695+
"FRONTEND_HOMEPAGE_FEATURE_ENABLED",
16951696
"FRONTEND_FOOTER_FEATURE_ENABLED",
16961697
"FRONTEND_THEME",
16971698
"MEDIA_BASE_URL",

src/backend/core/tests/test_api_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
COLLABORATION_WS_URL="http://testcollab/",
2020
CRISP_WEBSITE_ID="123",
2121
FRONTEND_CSS_URL="http://testcss/",
22+
FRONTEND_HOMEPAGE_FEATURE_ENABLED=True,
2223
FRONTEND_FOOTER_FEATURE_ENABLED=True,
2324
FRONTEND_THEME="test-theme",
2425
MEDIA_BASE_URL="http://testserver/",
@@ -41,6 +42,7 @@ def test_api_config(is_authenticated):
4142
"CRISP_WEBSITE_ID": "123",
4243
"ENVIRONMENT": "test",
4344
"FRONTEND_CSS_URL": "http://testcss/",
45+
"FRONTEND_HOMEPAGE_FEATURE_ENABLED": True,
4446
"FRONTEND_FOOTER_FEATURE_ENABLED": True,
4547
"FRONTEND_THEME": "test-theme",
4648
"LANGUAGES": [

src/backend/impress/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ class Base(Configuration):
410410
FRONTEND_THEME = values.Value(
411411
None, environ_name="FRONTEND_THEME", environ_prefix=None
412412
)
413+
FRONTEND_HOMEPAGE_FEATURE_ENABLED = values.BooleanValue(
414+
default=False,
415+
environ_name="FRONTEND_HOMEPAGE_FEATURE_ENABLED",
416+
environ_prefix=None,
417+
)
413418
FRONTEND_URL_JSON_FOOTER = values.Value(
414419
None, environ_name="FRONTEND_URL_JSON_FOOTER", environ_prefix=None
415420
)

src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const config = {
1010
COLLABORATION_WS_URL: 'ws://localhost:4444/collaboration/ws/',
1111
ENVIRONMENT: 'development',
1212
FRONTEND_CSS_URL: null,
13+
FRONTEND_HOMEPAGE_FEATURE_ENABLED: true,
1314
FRONTEND_FOOTER_FEATURE_ENABLED: true,
1415
FRONTEND_THEME: 'default',
1516
MEDIA_BASE_URL: 'http://localhost:8083',

src/helm/env.d/dev/values.impress.yaml.gotmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ backend:
5050
DB_USER: dinum
5151
DB_PASSWORD: pass
5252
DB_PORT: 5432
53+
FRONTEND_HOMEPAGE_FEATURE_ENABLED: true
5354
FRONTEND_FOOTER_FEATURE_ENABLED: true
5455
FRONTEND_URL_JSON_FOOTER: https://impress.127.0.0.1.nip.io/contents/footer-demo.json
5556
POSTGRES_DB: impress

0 commit comments

Comments
 (0)