You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Konrad Billewicz <ko...@akonet.pl> on 2005/08/17 09:28:24 UTC

Best way to store config variables

Hello,

I'm thinking about the way of storing config variables in my Struts (at Tomcat) 
application. Currently I have them hardcodded what was the big problem during 
instalation in a different enviroment. These variables are ie. enviroment-
dependent DIRs, passwords (can be stored as plain text, without encryption). I 
wish make them easy to change during installation and future maintance without 
programmers help.

At the moment I wish to do it using web.xml or, maybe better, context file in 
conf/Catalina/. Currently there are serveral things to change ie. data source 
parameters.

What do you think about it?

Best regards,
Konrad Billewicz



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Best way to store config variables

Posted by Dave Newton <ne...@pingsite.com>.
Craig McClanahan wrote:

>On 8/17/05, Dave Newton <ne...@pingsite.com> wrote:
>  
>
>>I think storing it under the Tomcat config directories would be a really
>>bad idea, since they're application (not server) level configs.
>>
>>Personally, I keep things like this in either web.xml, a struts config
>>file, or an application-specific configuration mechanism (generally XML
>>or YAML).
>>
>There is actually a counter-argument to this that matters a lot in
>some environments, where storing application-specific configuration
>information externally is the best answer.  In many development
>environments, an application gets deployed to at least two
>(development and production), and often three (development,
>test/staging, and production) different servers, each connected to
>different database and other resources, and perhaps configured with
>different application specific settings.
>
>Externalizing the configuration into the server settings lets you take
>*exactly* the same WAR file and deploy it into each of these
>environments, without having to bust it apart and change the
>appropriate settings each time.
>  
>
Ooo, yeah, that's a good point... Hrm.

Man, there goes my Wednesday :/

Dave


Re: Best way to store config variables

Posted by Konrad Billewicz <ca...@carolus.pl>.
Craig McClanahan <craigmcc <at> gmail.com> writes:

> For Tomcat in particular, I'd encourage you to use the JNDI naming
> context mechanisms for defining initialization parameters and data
> sources.

I have done it in this way. I think it will be good solution (explanations in 
other posts). Thank you for advice and argumentation. During installation I will 
do as you wrote - export appliction as war file and change configuration options 
 only using context.

Best regards,
Konrad Billewicz






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Best way to store config variables

Posted by Craig McClanahan <cr...@gmail.com>.
On 8/17/05, Dave Newton <ne...@pingsite.com> wrote:
> Konrad Billewicz wrote:
> 
> >At the moment I wish to do it using web.xml or, maybe better, context file in
> >conf/Catalina/. Currently there are serveral things to change ie. data source
> >parameters.
> >
> >What do you think about it?
> >
> >
> I think storing it under the Tomcat config directories would be a really
> bad idea, since they're application (not server) level configs.
> 
> Personally, I keep things like this in either web.xml, a struts config
> file, or an application-specific configuration mechanism (generally XML
> or YAML).
> 

There is actually a counter-argument to this that matters a lot in
some environments, where storing application-specific configuration
information externally is the best answer.  In many development
environments, an application gets deployed to at least two
(development and production), and often three (development,
test/staging, and production) different servers, each connected to
different database and other resources, and perhaps configured with
different application specific settings.

Externalizing the configuration into the server settings lets you take
*exactly* the same WAR file and deploy it into each of these
environments, without having to bust it apart and change the
appropriate settings each time.

For Tomcat in particular, I'd encourage you to use the JNDI naming
context mechanisms for defining initialization parameters and data
sources.  More information is at:

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

> Dave

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Best way to store config variables

Posted by Dave Newton <ne...@pingsite.com>.
Konrad Billewicz wrote:

>At the moment I wish to do it using web.xml or, maybe better, context file in 
>conf/Catalina/. Currently there are serveral things to change ie. data source 
>parameters.
>
>What do you think about it?
>  
>
I think storing it under the Tomcat config directories would be a really 
bad idea, since they're application (not server) level configs.

Personally, I keep things like this in either web.xml, a struts config 
file, or an application-specific configuration mechanism (generally XML 
or YAML).

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org