Apache Sling Context-Aware Configuration - Override via OSGi configuration | Community
Skip to main content
Level 2
March 5, 2020
Solved

Apache Sling Context-Aware Configuration - Override via OSGi configuration

  • March 5, 2020
  • 2 replies
  • 4974 views

I am investigating the feasibility of overriding the Context Aware values using OSGi configurations as stated in this document https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html#override-via-osgi-configuration

 

Essentially this is for having different values based on run mode configurations. Not for production environment.

 

For example, I am taking the a sample implementation created by Jörg here. If I want to overwrite the value of the property 'approverGroup' in  caconfig file following the above doc by providing a run mode config for the factory for e.g  org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider-test1. Is the value for 'overrides' property something like this to do the job. I tried below and it doesn't seem to work. Or am I missing something else?

[/content/test/en]de.joerghoh.cqdump.caconfig.workflow.CaConfigParticipantStepChooserConfig/approverGroup =osgi-approver

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by aem65user

The correct config is as following to override via OSGi

overrides="[[/content/test/en]de.joerghoh.cqdump.caconfig.workflow.CaConfigParticipantStepChooserConfig/approverGroup="osgi-approver"]"

 

Corrected the answer as the fix was to change the quotes after the equals sign. 

2 replies

arunpatidar
Community Advisor
Community Advisor
March 5, 2020

Both Context aware config and osgi config are different. Context aware config works based on path and OSGi config based on repo/web console value.

 

But whenever you wanna use CAC there you can make a check for user/group to use OSGi config instead of CAC.

Arun Patidar
aem65userAuthor
Level 2
March 6, 2020

Hi Arun,

 

I agree with you that both are different and the context of its usage.

 

However it is stated in sling documentation that we can override the ca config values using osgi config in non prod environments. I've tried that but I could not make it work in my local by using the above config. My concern if the factory config I am using to override is correct and if the value format is correct

 

Best Regards

Paul

aem65userAuthorAccepted solution
Level 2
March 8, 2020

The correct config is as following to override via OSGi

overrides="[[/content/test/en]de.joerghoh.cqdump.caconfig.workflow.CaConfigParticipantStepChooserConfig/approverGroup="osgi-approver"]"

 

Corrected the answer as the fix was to change the quotes after the equals sign.