lms.djangoapps.mfe_config_api package#
Submodules#
lms.djangoapps.mfe_config_api.urls module#
URLs configuration for the mfe api.
lms.djangoapps.mfe_config_api.views module#
MFE API Views for useful information related to mfes.
- class lms.djangoapps.mfe_config_api.views.FrontendSiteConfigView(**kwargs)#
Bases:
APIViewProvides the frontend site configuration endpoint.
Returns the contents of
FRONTEND_SITE_CONFIGmerged on top of a compatibility translation of the legacyMFE_CONFIG/MFE_CONFIG_OVERRIDESsettings. Once legacy configuration is fully deprecated, the translation layer can be removed and this view will simply returnFRONTEND_SITE_CONFIGas-is.- authentication_classes = []#
- get(request)#
Return frontend site configuration.
Usage
GET /api/frontend_site_config/v1/
GET Response Values ``` {
“siteName”: “My Open edX Site”, “baseUrl”: “https://apps.example.com”, “lmsBaseUrl”: “https://courses.example.com”, “loginUrl”: “https://courses.example.com/login”, “logoutUrl”: “https://courses.example.com/logout”, …
}#
- permission_classes = [<class 'rest_framework.permissions.AllowAny'>]#
- class lms.djangoapps.mfe_config_api.views.MFEConfigView(**kwargs)#
Bases:
APIViewProvides an API endpoint to get the MFE configuration from settings (or site configuration).
- get(request)#
Return the MFE configuration, optionally including MFE-specific overrides.
This configuration currently also pulls specific settings from site configuration or django settings. This is a temporary change as a part of the migration of some legacy pages to MFEs. This is a temporary compatibility layer which will eventually be deprecated.
See [DEPR ticket](openedx/edx-platform#37210) for more details.
The compatibility means that settings from the legacy locations will continue to work but the settings listed below in the get_legacy_config function should be added to the MFE config by operators.
Usage
Get common config: GET /api/mfe_config/v1
Get app config (common + app-specific overrides): GET /api/mfe_config/v1?mfe=name_of_mfe
GET Response Values ``` {
“BASE_URL”: “https://name_of_mfe.example.com”, “LANGUAGE_PREFERENCE_COOKIE_NAME”: “example-language-preference”, “CREDENTIALS_BASE_URL”: “https://credentials.example.com”, “DISCOVERY_API_BASE_URL”: “https://discovery.example.com”, “LMS_BASE_URL”: “https://courses.example.com”, “LOGIN_URL”: “https://courses.example.com/login”, “LOGOUT_URL”: “https://courses.example.com/logout”, “STUDIO_BASE_URL”: “https://studio.example.com”, “LOGO_URL”: “https://courses.example.com/logo.png”, “ENABLE_COURSE_SORTING_BY_START_DATE”: True, “HOMEPAGE_COURSE_MAX”: 10, … and so on
}#
- lms.djangoapps.mfe_config_api.views.get_explicit_mfe_config_overrides() dict#
Return MFE-specific overrides from settings or site configuration.
- Returns:
A dictionary keyed by MFE name, where each value is a dict of per-MFE overrides. Non-dict entries are filtered out.
- lms.djangoapps.mfe_config_api.views.get_frontend_site_config() dict#
Return frontend site configuration from settings or site configuration.
Unlike MFE_CONFIG, this setting is already in frontend-base’s expected camelCase format and requires no translation.
- lms.djangoapps.mfe_config_api.views.get_legacy_config() dict#
Return legacy configuration values available in either site configuration or django settings.
- lms.djangoapps.mfe_config_api.views.get_legacy_config_overrides() dict#
Return per-app legacy configuration overrides.
Same shape as get_explicit_mfe_config_overrides(): a dict keyed by MFE name, where each value is a dict of config values.
This is a compatibility layer for per-app values that historically came from legacy systems (e.g., help-tokens).
- lms.djangoapps.mfe_config_api.views.get_mfe_config() dict#
Return common MFE configuration from settings or site configuration.
- Returns:
A dictionary of configuration values shared across all MFEs.
- lms.djangoapps.mfe_config_api.views.get_mfe_config_overrides() dict#
Return all MFE-specific overrides, merging legacy fallbacks with explicit settings.
Legacy per-app fallbacks (e.g., from help-tokens) are included at the lowest precedence; explicit MFE_CONFIG_OVERRIDES from settings or site configuration take priority.
- Returns:
A dictionary keyed by MFE name, where each value is a dict of per-MFE overrides.
- lms.djangoapps.mfe_config_api.views.mfe_name_to_app_id(mfe_name: str) str#
Convert a legacy MFE name to a frontend-base appId.
Uses an explicit mapping of known MFE names to reverse-domain appIds. Falls back to a programmatic kebab-to-camelCase conversion for unknown names.
- lms.djangoapps.mfe_config_api.views.resolve_help_token(token: str) str | None#
Resolve a help-tokens token to a URL, returning None if the token cannot be resolved.
- lms.djangoapps.mfe_config_api.views.translate_legacy_mfe_config() dict#
Translate legacy MFE_CONFIG/MFE_CONFIG_OVERRIDES into frontend-base site config format.
This entire function is a compatibility layer that can be removed once legacy MFE configuration (MFE_CONFIG, MFE_CONFIG_OVERRIDES, and the related get_legacy_config/get_mfe_config/get_mfe_config_overrides helpers) is fully deprecated.
Most legacy keys are renamed via SITE_CONFIG_TRANSLATION_MAP. PARAGON_THEME_URLS is structurally translated into the new theme setting and intentionally narrowed to brand-override URLs only (see translate_paragon_theme_urls).
Returns a dict in the shape expected by frontend-base’s SiteConfig.
- lms.djangoapps.mfe_config_api.views.translate_paragon_theme_urls(legacy_theme) dict#
Translate legacy PARAGON_THEME_URLS into frontend-base’s theme site config.
frontend-base loads Paragon’s base CSS via its shell stylesheet, so the runtime theme setting is only for brand overrides. Only urls.brandOverride entries are kept; legacy url and urls.default values point at Paragon defaults and would clobber the bundled CSS, so they are dropped. defaults passes through unchanged.
Non-dict inputs (e.g., misconfigured settings) yield an empty dict.