-
1. Re: Property File/Module per server group
jjdevine Oct 29, 2013 8:16 AM (in response to jjdevine)To simply this a bit.. I'm basically deploying the same EAR file into two different server groups (live and test). The EAR file loads configuration from an external property file that currently sits in a custom module and is referenced from jboss-deployment-structure.xml, within the EAR file. The problem is that the contents of the property file needs to be different between the live and test version of the EAR file, but I'm not sure how to point the two server groups to different versions of the property file, given that the property file is within a module (in the single 'modules' folder), and I don't want to have to modify the EAR between the two server groups to use separate modules.
I've had 2 ideas, but I don't like either of them:
a) Set up a 'live' and 'test' profile in domain.xml, and use the <global-modules> element to reference a different module for each profile, one containing the live version of the property file, and the other containing the test version of the property file. The 'live' server group can then use the 'live' profile, and the 'test' server group can use the 'test' profile. The problem with this is that I would then have two lengthy profile declarations that are almost identical except for the module declaration. Is there a better solution that this? Is there a way of declaring a 'parent' profile, and then the live and test profiles can inherit from the 'parent', and just declare the global modules section since this is the only difference between them?
b) Get rid of the external property files and change the application to look up the configuration via JNDI. This may be the 'best practice' way but it would involve a lot of changes to the application that we don't really have the time for right now, plus the application also gets deployed on weblogic so all our config for that would have to be redone.
-
2. Re: Re: Property File/Module per server group
sfcoy Oct 29, 2013 8:33 AM (in response to jjdevine)1 of 1 people found this helpful- Put all of the the properties files in the same module, but (say) prefixed with the environment name. For instance, live-config.properties, test-config.properties, etc.
- Define a single JNDI binding in the naming configuration for each profile:
<subsystem xmlns="urn:jboss:domain:naming:1.2"> <!-- use the right version for your server here! --> <bindings> <simple name="java:/jboss/env-name" value="live"/> </bindings> </subsystem>
- Look this up (or better - inject it), and use the value to select which properties file to read.