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

How to find from OsgiConfiguration if it is a Preview instance?

Avatar

Level 2
 
1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

You may refer to the community blog: https://medium.com/slalom-technology/how-to-use-environment-variables-in-adobe-experience-manager-ae... how you can set environment variable using CM API and use in OSGI config.

 

Thanks

Wasil

View solution in original post

4 Replies

Avatar

Employee Advisor

config.preview OSGi configuration folder cannot be declared the same way a config.publish can be declared folder. Instead, the preview tier inherits its OSGi configuration from the publish tier’s values. Check the section "Author versus Publish Configuration" on OSGI Configuration documentation  

 

HTH

 

Thanks,

Wasil

Avatar

Level 2

Hi @wasil_z ,

I read the documentation , I need a separate configuration for preview instance 

  • the first option, which is recommended: in all OSGi folders (like config.author and config.publish) declared to define different values, use the same variable name. For example
    $[env:ENV_VAR_NAME;default=<value>], where the default corresponds to the default value for that tier (author or publish). When setting the environment variable via Cloud Manager API or via a client, differentiate between the tiers using the “service” parameter as described in this API reference documentation. The “service” parameter will bind the variable’s value to the appropriate OSGi tier. It can be “author” or “publish” or “preview”.

I'm unsure how to give this service parameter in config json file or in java OCD. 

avvidya931_0-1665072181248.png

 

Avatar

Correct answer by
Employee Advisor

You may refer to the community blog: https://medium.com/slalom-technology/how-to-use-environment-variables-in-adobe-experience-manager-ae... how you can set environment variable using CM API and use in OSGI config.

 

Thanks

Wasil