How to externalize properties files

Hi,

I thought I would add my own alternative solution. I don’t like the idea of adding the properties file directly to the Tomcat lib directory. I would sooner not clutter up the lib directory with application specific properties like this as it can be a pain to maintain.

Instead, add a context XML file for the tomcat deployment that remaps an external properties file into the WEB-INF directory. This way Flowable will pick it up as being on the classpath even if its outside of the WAR file.
In practice:

Create a file at $CATALINA_HOME/conf/Catalina/localhost/flowable-task.xml with the content:

<Context>
  <Resources>
    <PreResources className="org.apache.catalina.webresources.FileResourceSet"
            base="/path/to/external/properties/files/flowable-ui-app.properties"
            webAppMount="/WEB-INF/classes/flowable-ui-app.properties" />
  </Resources>
</Context>

You will need a context file for each Flowable app that is deployed (e.g. flowable-idm, flowable-modeler, etc). This then acts as if the the file at /path/to/external/properties/files/flowable-ui-app.properties is present at $CATALINA_HOME/webapps/flowable-task/WEB-INF/classes/flowable-ui-app.properties

This then allows the properties files to be kept in a specific folder without cluttering up the Tomcat lib folder.

/ Paul

2 Likes