Hi @aryaba1,
Managing environment-specific configurations should be done using Context-Aware Configuration (CAC) in combination with runmode-specific OSGi configs. Here's a breakdown of the recommended approach:
1. Use Context-Aware Configuration (CAC)
-
CAC allows you to store config values in the content structure (e.g., /conf/my-site) and access them dynamically based on the page context.
-
Example: Store a config.json under /conf/my-site/settings/cloudconfigs/my-api-config.
{
"apiUrl": "https://dev.api.example.com",
"featureFlag": true
}
2. Use Runmode-Specific OSGi Configurations
/apps/myproject/osgiconfig/config.dev/com.myproject.core.services.MyApiConfig.cfg.json
{
"api.endpoint": "https://dev.api.example.com"
}
3. Avoid Hardcoding or Environment Detection in Code
-
Never use if(runmode == "dev") logic in code.
-
Instead, inject configuration using OSGi or CAC, and keep code environment-agnostic.
4. Use Adobe Cloud Manager’s Pipeline Variables (if needed)
-
For non-code configuration like secrets or toggles, use Adobe Cloud Manager pipeline variables.
-
Inject them via OSGi or environment variable bridge patterns.
Hope that helps!