You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by ernst Developer <er...@gmail.com> on 2012/12/06 10:55:36 UTC

Property files

Hi,

Syncope console has a property file named configuration.properties, that
contains property values which are environment specific.
Everytime Syncope is installed on some servlet container, I need to do a
change property values in configuration.properties for the environment I am
working on and do a build.

I think that it is possible to move the configuration.properties out of the
build, and configure the properties in a file per environment.

We could do this by changing the
console/src/main/resources/applicationContext.xml.

Now the context file has for the configuration.properties file:

* <bean id="propertyConfigurer"*
*
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
*
*    <property name="locations">*
*      <list>*
*        <value>classpath:configuration.properties</value>*
*      </list>*
*    </property>*
*  </bean>*
*
*
If we change this and add another bean:

*    <bean id="propertyConfigurer2"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
*
*        <property name="order" value="1"/>*
*        <property name="location"
value="file:#{(systemProperties['user.home'] +
'/.configuration.properties')}"/>*
*        <property name="ignoreResourceNotFound" value="true"/>*
*        <property name="ignoreUnresolvablePlaceholders" value="true"/>*
*    </bean>*

We only have to create a .configuration.properties file in the home
directory of the user that runs the servlet container on which syncope is
deployed. If the file is not found, it still the default
configuration.properties file from within the war file is used.

Easy right?

Regards,
Ernst

Re: Property files

Posted by Fabio Martelli <fa...@gmail.com>.
Il giorno 06/dic/2012, alle ore 10.55, ernst Developer ha scritto:

> Hi,
> 
> Syncope console has a property file named configuration.properties, that
> contains property values which are environment specific.
> Everytime Syncope is installed on some servlet container, I need to do a
> change property values in configuration.properties for the environment I am
> working on and do a build.
> 
> I think that it is possible to move the configuration.properties out of the
> build, and configure the properties in a file per environment.
> 
> We could do this by changing the
> console/src/main/resources/applicationContext.xml.
> 
> Now the context file has for the configuration.properties file:
> 
> * <bean id="propertyConfigurer"*
> *
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
> *
> *    <property name="locations">*
> *      <list>*
> *        <value>classpath:configuration.properties</value>*
> *      </list>*
> *    </property>*
> *  </bean>*
> *
> *
> If we change this and add another bean:
> 
> *    <bean id="propertyConfigurer2"
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
> *
> *        <property name="order" value="1"/>*
> *        <property name="location"
> value="file:#{(systemProperties['user.home'] +
> '/.configuration.properties')}"/>*
> *        <property name="ignoreResourceNotFound" value="true"/>*
> *        <property name="ignoreUnresolvablePlaceholders" value="true"/>*
> *    </bean>*
> 
> We only have to create a .configuration.properties file in the home
> directory of the user that runs the servlet container on which syncope is
> deployed. If the file is not found, it still the default
> configuration.properties file from within the war file is used.
> 
> Easy right?

Hi Ernst, 
from my PPOV it sounds easy and good enough.

I think you can open a new issue to schedule this refactoring.

Best regards,
F.