Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEMaaCS | Unable to read cloud environment and secret variables from AEM cloud in AEM OSGI config

Avatar

Level 1

Hi,
cc @kautuk_sahni 
I am unable to read the environment and secret variables from AEM cloud in my OSGI config (ui.config/src/main/content/jcr_root/apps/proj/osgiconfig/config.author.dev/com.proj.service.impl.ServiceImpl.config.cfg.json)

{
    "apiUrl": "$[env:EFIX_BACKEND_URL;default=https://some.value.foo/bar]",
    "secretKey": "$[secret:EFIX_BACKEND_USER]",
    "secretVal": "$[secret:EFIX_BACKEND_PASSWORD]",
    "timeout:Integer":1000
}


We have the environment and secret variables from AEM cloud author as below:

aemEon_0-1697748556027.png

Am i missing something? 

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

The variable definition looks correct. I would suggest checking how you are retrieving the values. Please look at this post, which has a full example of how to use the variables once set up https://medium.com/slalom-technology/how-to-use-environment-variables-in-adobe-experience-manager-ae... 



Esteban Bustamante

View solution in original post

5 Replies

Avatar

Community Advisor

Can you verify you don't have a run mode selection conflict?

Something like another config under ui.config/src/main/content/jcr_root/apps/proj/osgiconfig/config.author/com.proj.service.impl.ServiceImpl.config.cfg.json

 

 



Esteban Bustamante

Avatar

Level 1

@EstebanBustamante  thanks for your response. 
On AEM Cloud DEV we can see the config for the pid com.proj.service.impl.ServiceImpl.config which confirms the runmode is fine, but these osgi config values with expression are not getting replaced from the cloud environment and secret variables as we can see in logs the StringUtils.isNotBlank() is returning false for the config value in service. 

Avatar

Correct answer by
Community Advisor

The variable definition looks correct. I would suggest checking how you are retrieving the values. Please look at this post, which has a full example of how to use the variables once set up https://medium.com/slalom-technology/how-to-use-environment-variables-in-adobe-experience-manager-ae... 



Esteban Bustamante

Avatar

Employee

Hi,

The steps mentioned in https://medium.com/slalom-technology/how-to-use-environment-variables-in-adobe-experience-manager-ae... are not working for me. I am getting null values although I am entering the value under Configuration in the program.

Avatar

Administrator

@EstebanBustamante Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni