Open AlexZorkin opened 1 week ago
The feature_flags object has been added in the configmap. The configmap is mapped as /app/config/config.js in frontend pod. $ cat config.js window.lcfs_config = { api_base: 'https://lcfs-backend-dev.apps.silver.devops.gov.bc.ca/api', keycloak: { REALM: 'standard', CLIENT_ID: 'low-carbon-fuel-standard-5147', AUTH_URL: 'https://dev.loginproxy.gov.bc.ca/auth', POST_LOGOUT_URL: 'https://lcfs-dev.apps.silver.devops.gov.bc.ca/', SM_LOGOUT_URL: 'https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=' }, feature_flags: { supplementalReporting: true, notifications: false } }
Description:
Implement a build-time configuration system for managing feature flags in the frontend. The system will allow feature availability (e.g., Supplemental Reporting, Notifications) to be dynamically toggled using a centralized configuration class (
window.lcfs_config
). This approach ensures immediate updates upon reload, eliminates backend dependency, and simplifies feature flag management.Acceptance Criteria:
Centralized Configuration:
window.lcfs_config
object includes afeature_flags
key for managing feature states.Helper Function:
isFeatureEnabled
) provides safe access to feature flags.Navbar Integration:
Route Management:
Environment Injection:
window.lcfs_config
is populated at build time with environment-specific values.Fallback Defaults:
window.lcfs_config
is incomplete.Development Checklist:
Frontend Implementation:
Update
window.lcfs_config
with feature_flags object:Helper Function:
Update Navbar:
Route Wrapping:
isFeatureEnabled
:Environment-Specific Injection:
window.lcfs_config
is dynamically populated during the build process based on the target environment (dev
,test
,prod
). In openshift we will need mounted config_maps with our config.js fileTesting:
Unit Tests:
isFeatureEnabled
utility with various feature flag states.Integration Tests:
Manual Verification:
Purpose and Benefits: