How to find from OsgiConfiguration if it is a Preview instance? | Community
Skip to main content
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 WasilZee

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

 

Thanks

Wasil

3 replies

Adobe Employee
October 6, 2022

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

manjunathdj
October 6, 2022

@avvidya931  - Check the AEM Run Mode to determine its author/publish...

Preview is custom made run mode on top of publish server.

http://localhost:4502/system/console/status-slingsettings

https://sourcedcode.com/blog/aem/how-to-check-all-active-run-modes-in-a-running-aem-instance

 

Level 2
October 6, 2022

Hi @wasilzee ,

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. 

 

WasilZeeAdobe EmployeeAccepted solution
Adobe Employee
October 10, 2022

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

 

Thanks

Wasil