Description
Description
This is the first step of exploration to make MFE easy to configure from an instance.
And is part of a conversation that took place in the BTR WG reference here
You can check this document for a better context, and we appreciate your feedback.
Problem we try to hack
MFEs are only configured at build time. We need to be able to configure them at runtime to avoid needing a re-build for every MFE with every change in configuration.
How we can solve this
A proposal is to make a call API to set the configuration variables.
-
In the MFE can set the environment variable MFE_CONFIG_API_URL, which is optional and people can choose if use the env file or call the API (setting the variable).
-
The configuration could be set by site configuration in an object like this:
{
"MFE_CONFIG": {
"SITE_NAME": "Test Site",
"LOGO_URL": "https://testimage.com/logo.svg",
"LOGO_TRADEMARK_URL": "https://testimage.com/logo.svg",
"LOGO_WHITE_URL": "https://testimage.com/logo.svg",
"FAVICON_URL": "https://testimage.com/favicon.ico",
"CSRF_TOKEN_API_PATH": "/csrf/api/v1/token",
"LANGUAGE_PREFERENCE_COOKIE_NAME": "openedx-language-preference",
"LOGIN_URL": "http://testsite.example.com/login",
"LOGOUT_URL": "http://testsite.example.com/logout",
"STUDIO_BASE_URL": "http://studio.example.com",
"MARKETING_SITE_BASE_URL": "http://testsite.example.com",
"ORDER_HISTORY_URL": "http://testsite.example.com/orders",
"REFRESH_ACCESS_TOKEN_ENDPOINT": "http://testsite.example.com/login_refresh",
}
}
This object is read in the initialize function and if it's all okay, start the frontend application.
Pull request based on this proposal
-
Frontend-Platform: Create a new function that is only activated if MFE_CONFIG_API_URL is set and make an API call to set the configuration variables.
-
Edx-Platform: Create the API configuration service to read the site configuration and return the MFE_CONFIG.
-
Enable runtime config in frontend-apps (favicon and title tag using Helmet and i18n):
- Account (we want to open the discussion with one app and make the same changes eventually in the next ones) due to the new
npm ci
validation is necessary to upgradetensorflow/tfjs-converter
andtensorflow/tfjs-core
- Learning due to new
npm ci
validation is necessary upgrade@edx/frontend-lib-special-exams
- Profile
- Gradebook
Pending MFEs
- feat: allow runtime configuration frontend-app-support-tools#274
- feat: allow runtime configuration frontend-app-authn#654
- feat: allow runtime configuration frontend-app-publisher#786
- Allow Runtime Configuration frontend-app-learner-record#104
- [frontend-app-course-authoring] Allow runtime configuration #143
- [frontend-app-ora-grading] Allow runtime configuration #144
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status