Expand my Community achievements bar.

Apache Sling Context Aware Configurations Override via OSGI Configuration

Avatar

Level 1

Hi, 
We are using OOTB ca-config "com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig" to load a script on our page.
But the script src is different for each environment. So, to override it through OSGI, I have tried using Apache Sling Context-Aware Configuration Override Provider: OSGi configuration. 
my Ca-config is stored as follows:

 

Screenshot 2024-11-26 at 13.33.53.png

Screenshot 2024-11-26 at 13.34.05.png

 I want override the "value" property of srcAttr and my Override provider config is as follows: 

Screenshot 2024-11-26 at 13.39.53.png

but I am unable to achieve it,
could someone help me what's need to be corrected in this case?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Hi,

 

I think there’s some confusion, or perhaps I misunderstood your use case. If you need to switch a script per environment, you should use run modes and environment variables, as this is a more flexible and scalable approach. Context-Aware configurations are intended for multi-tenant projects within the same environment. Please check these threads:

 

https://stackoverflow.com/questions/57067256/how-do-i-use-run-modes-with-context-aware-configuration...

https://medium.com/@toimrank/aem-run-modes-4c36b9b0068e

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/usi...

 

Hope this helps



Esteban Bustamante