Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How to maintain custom configurations for project in different environments?

Avatar

Level 3

Hi,

I have 2 different projects/sites with two separate code base. I have some custom configurations for accessing webservices from different server (WS URL) etc. These URLs are different for different environments (Dev, QA, Pre-Prod, Prod).

What is the best way to handle these configurations? Is it via creating different config folders for different run modes?

Please suggest and it would be helpful if you can give me a link that explains how to create configurations (custom configurations) for different run modes.

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Employee

Yes, the best way to handle configurations for the same class, same project but in different environments is via run modes. Please refer to http://docs.adobe.com/docs/en/aem/6-0/deploy/configuring/configuring-osgi.html#OSGi%20Configuration%... .

View solution in original post

7 Replies

Avatar

Correct answer by
Employee

Yes, the best way to handle configurations for the same class, same project but in different environments is via run modes. Please refer to http://docs.adobe.com/docs/en/aem/6-0/deploy/configuring/configuring-osgi.html#OSGi%20Configuration%... .

Avatar

Level 3

Hi Kalyanar,

Thanks for the reply. That was very informative. 

Quick one, in AEM 6 where can I see the PID for my bundle/service?

Thanks,

-A

Avatar

Employee

In configuration tab in system console, you will see the pid for each configuration. When you click open the configuration model, you will see something like this.

     
Persistent Identity (PID)com.adobe.acs.commons.wcm.impl.ComponentHelperImpl

Avatar

Level 3

Hi Kalyanar,

I have created a config folder in my project with a sling:OsgiConfig node for one of my service (com.test.impl.DistanceServiceImpl) and added properties to the node. I'm able to read the value in the bundle and all works fine !

 Now, how do I change the value of one of this property? Go to CRXDE Lite and change it? I would like to change the value through Felix console as CRXDE Lite is disabled in Production.

Thanks,

-A

Avatar

Employee

since you have the osgiconfig node, this can be safely in your git/svn. So always change the nodes in prod by installing a new config package which does this. This allows you better control.

Avatar

Level 3

Problem with that approach is, we have got application support/management guys who has access to production and does the support. And there are some values specific to production environment that shouldn't be accessible to developers. These values needs to be added to the production environment directly.

What I have done to overcome this issue is, added osgiConfig node (com.test.impl.DistanceServiceImpl.config) and stored the non-changable parameters here. Then in the class, added @Property values that needs to be configured through Felix console.

Please let me know if this is the right approach.

Thanks

Avatar

Employee

Manual intervention to a production system could be risky and not many allow that. We can rather store these configs in svn but only giv access to these support guys. Nowadays, a simple script can be written to fetch the correct file and package it and install in prod. This helps versioning as well. Ofcourse, training the team on how to use svn and running scripts will help.