You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Paul Wellner Bou <pw...@gmail.com> on 2013/09/11 08:52:04 UTC
Using different velocity.properties depending on the environment
Good morning,
is it possible to point to the velocity.properties file using
environment variables?
we have a velocity.properties in our classpath, this should be used as
default and in production environments. Then, we have another one,
named, for example velocity-dev.properties (or in another directory,
like dev/velocity.properties), which has different settings for
logging, caching and refreshing as the production file.
Is it possible to start the container or the war file with something
like -Dorg.apache.velocity.properties=velocity-dev.properties, similar
as it is done with the log4j configuration file?
Thanks and regards
Paul.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: Using different velocity.properties depending on the environment
Posted by Nathan Bubna <nb...@gmail.com>.
VelocityView (from VelocityTools) has abilities like this, but the
core engine does not. But, you can always put the check into your own
code where you create your VelocityEngine:
String propsFilePath = System.getProperty("org.apache.velocity.properties");
VelocityEngine engine;
if (propsFilePath == null) {
engine = new VelocityEngine();
} else {
engine = new VelocityEngine(propsFilePath);
}
On Tue, Sep 10, 2013 at 11:52 PM, Paul Wellner Bou <pw...@gmail.com> wrote:
> Good morning,
>
> is it possible to point to the velocity.properties file using
> environment variables?
>
> we have a velocity.properties in our classpath, this should be used as
> default and in production environments. Then, we have another one,
> named, for example velocity-dev.properties (or in another directory,
> like dev/velocity.properties), which has different settings for
> logging, caching and refreshing as the production file.
>
> Is it possible to start the container or the war file with something
> like -Dorg.apache.velocity.properties=velocity-dev.properties, similar
> as it is done with the log4j configuration file?
>
> Thanks and regards
> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org