You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark <ma...@xeric.net> on 2011/10/03 21:01:06 UTC

Re: Where to store site settings?

On Wed, Sep 28, 2011 at 11:47 AM, Tim <ko...@gmail.com> wrote:

> Can someone please tell me the best way to store site settings in a
> Tapestry application?
>
>
You can set a context parameter in web.xml like this:

<context-param>
     <param-name>registration.properties-file</param-name>
     <param-value>misc/registration.properties</param-value>
</context-param>
(I'm not sure, but putting things in app.properties may do the exact same
thing, but without the XML.)

I use Apache Common's to handle the properties in situations where I want
the users to be able to update them from the webapp and the values to be
saved to the properties file. So what you see above is how I set the name of
the properties file in the first place.

Then I get the value in a service using a constructor like:

 public ConfigurationImpl(@Value("${registration.properties-file}") String
fileName)

For handling the differences between test and production, my master branch
sets the registration.properties at one location and my deployment branches
set it in a different location. Before deploying I always merge everything I
need from master to the deployment branch and deploy from there.

I'm not saying that is the best way to handle it, but that is what I'm doing
for one of my applications and it seems to be working well. In particular,
it makes it easy for me to wipe out my database during testing without
losing all the configuration data.

Mark