How to override runtime-properties
Posted: Fri Nov 15, 2013 7:48 pm
Some production configurations are sensitive and cannot be put under development source control that's built into jar/war. These include payment gateway configuration, server API credential, etc. Our solution is to store such data under the server file system that only operation team has access, for instance, under $CATALINA_HOME/config/ and let web app load it from there. The other non-sensitive configurations can still be under project/resources/runtime-properties.
The problem is how to merge these two sets of configurations. RuntimeEnvironmentPropertiesConfigurer implements a great way to merge properties from various properties. However, it hardcoded the file names to a predefined environments and to common, shared, etc. It ignores other files. I tried following:
<bean id="propertyConfigurer" class="org.broadleafcommerce.common.config.RuntimeEnvironmentPropertiesConfigurer">
<description>Property configurer for notification service properties input.</description>
<property name="locations">
<list>
<value>classpath*:/runtime-properties/*.properties</value>
<value>file:///${CATALINA_HOME}/config/runtime-properties/*.properties</value>
</list>
</property>
</bean>
And found it completely ignore the second file set.
I could put the sensitive data in configuration temporarily and build the war/jar, but if I try to build a formal release through maven, it'll complain that there are unchecked-in changes.
How should I resolve this problem?
Thank you!
The problem is how to merge these two sets of configurations. RuntimeEnvironmentPropertiesConfigurer implements a great way to merge properties from various properties. However, it hardcoded the file names to a predefined environments and to common, shared, etc. It ignores other files. I tried following:
<bean id="propertyConfigurer" class="org.broadleafcommerce.common.config.RuntimeEnvironmentPropertiesConfigurer">
<description>Property configurer for notification service properties input.</description>
<property name="locations">
<list>
<value>classpath*:/runtime-properties/*.properties</value>
<value>file:///${CATALINA_HOME}/config/runtime-properties/*.properties</value>
</list>
</property>
</bean>
And found it completely ignore the second file set.
I could put the sensitive data in configuration temporarily and build the war/jar, but if I try to build a formal release through maven, it'll complain that there are unchecked-in changes.
How should I resolve this problem?
Thank you!