AEM osgiconfig node for different profile.



Hi Team,

As I have three Instances for aem one is author , publish and development, For this I have created three folders like, config.publish and config.development and created three sling:osgiConfig node with the same name but multiple copies in each of the folder,

And now with the help of data-sly-use  I am able to use the node properties.

But the problem here is in data-sly-use i Have to give the complete path of the node which included and so.

I have diff configuration for diff env for which i have to change the path in every env.

Please let me know how to use relative path and value of those propeties in my HTML.


Accepted Solutions (1)

Accepted Solutions (1)




You should never OSGI configuration explicitly, but you should let the container do this for you!

From what I understood you have these nodes:

* /apps/myapp/ (sling:osgiConfig)

* /apps/myapp/config.publish/x.y.z (sling:osgiConfig)

* /apps/myapp/config.development/x.y.z (sling:osgiConfig)

which is correct. Now you need to have a service with the PID x.y.z, which can be done the easiest way, if you "x.y" is the java package name and "z" is the classname of that service. Now you can read the configuration value as part of the service activation.

And as the next part you need to create a slingmodel, which is using your x.y.z service to do something useful, and embed that slingmodel into HTL.

This might sound overkill, but if it's really overkill, you are often trying to store parameters as OSGI configuration, which should not be OSGI configs at all.