Expand my Community achievements bar.

SOLVED

OsgiConfigurationOverrideProvider - Context Aware Configuration Override via OSGi configuration

Avatar

Community Advisor

I am working on a use case for overriding the content-aware configuration using OSGi configuration. It seems to be working perfectly fine on the development environment on the cloud. But the configuration does not override the value when it comes to the stage/production environment.

https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configurati...

 

org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider~pdf-viewer.cfg.json

 

{
"description": "Override provider for PDF Viewer Client ID",
"overrides": [
"[/content/brandx]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"$[env:API_KEY;default=xxxxxffbbxx4b0xxxxb65f5axxxxxdfx]\""
],
"enabled": true
}

 

Am I missing anything here?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Tanika02 @Himanshu_Jain @krati_garg @aanchal-sikka 

Thank you, everyone, for reviewing the issue and coming up with ideas. Finally, we were able to sort it out. It was an issue with the asset path which was not rendering and the PDF viewer was failing.

 

There is no issue with the configuration.

 

Thanks,

Asutosh

View solution in original post

12 Replies

Avatar

Community Advisor

Hello @Asutosh_Jena_ 

 

The configuration seems fine. After updating an Environment Variable, it takes some time on AaaCS to reflect. 

Can you possibly check, if the "API_KEY" is configured for Stage And PROD as well on Cloud manager?


Aanchal Sikka

Avatar

Community Advisor

Hi @aanchal-sikka Yes I can confirm the deployment is completed but unfortunately, I do not see it working.

Avatar

Employee Advisor

@Asutosh_Jena_ Can you please also mention the run mode you are using for Production environment here. Also, are you working upon AEMaaCS or Non Cloud version of AEM?

Avatar

Community Advisor

Hi @krati_garg 

Below are the run modes we are using:

Development: config.dev

Staging: config.stage

Production: config.prod

 

I am pretty sure it's not with run modes as other configs from the same run modes work perfectly fine without any issue and also uses environment variable on cloud manager.

 

This is on AEM as Cloud.

 

Thanks,
Asutosh

Avatar

Community Advisor

Hi @Asutosh_Jena_ 

 

Kindly rename your config

from 

org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider~pdf-viewer.cfg.json

 

to

org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider-pdf-viewer.cfg.json

 

replace~ with- in your config name .

 

Thanks

Himanshu

Himanshu Jain

Avatar

Community Advisor

Hi @Himanshu_Jain 

This is a factory configuration and has to be used with ~

Also, this works in a development environment so I don't see this as an issue.

 

Thanks,
Asutosh

Avatar

Community Advisor

HI @Asutosh_Jena_ 

We faced this for one of our config in AEM cloud instance (stage/Prod) and we tried the same .

Also this was on one of the POD not on all PODs .

For more details check https://issues.apache.org/jira/browse/SLING-11855

 

Thanks

Himanshu

Himanshu Jain

Avatar

Community Advisor

Hello @Asutosh_Jena_ 

 

Could you please confirm that the API_KEY environment variable is properly set in the stage/production environment. Check if it has the expected value or if the default value is being used. Ensure that the environment variable is accessible to the application at runtime.

Avatar

Community Advisor

Hi @Tanika02 

 

Confirming it has the API_KEY env variable defined properly in the console and it's accessible at runtime.

 

Thanks,

Asutosh

Avatar

Correct answer by
Community Advisor

@Tanika02 @Himanshu_Jain @krati_garg @aanchal-sikka 

Thank you, everyone, for reviewing the issue and coming up with ideas. Finally, we were able to sort it out. It was an issue with the asset path which was not rendering and the PDF viewer was failing.

 

There is no issue with the configuration.

 

Thanks,

Asutosh