Skip to content

How to Externalize database configuration

Lorenzo Pini edited this page May 27, 2016 · 12 revisions

In order to maximize configuration flexibility, it should be possible to use configuration files (e.g.: property files for DB configuration) located outside the .war package.

In GeoStore, you can define an externalized override file by setting the geostore-ovr system variable pointing to your file.

An override file is a property file where you can override the properties of the Spring beans declared inside the applicationContext file. See also the Spring javadoc documentation.

For instance, when using tomcat in a multiple instance installation (see RUNNING.txt inside tomcat distribution for more info), you can set the geostore-ovr variable in your setenv.sh (or setenv.bat):

  CATALINA_BASE=/var/tomcat/$INSTANCE_NAME
  GEOSTORE_OVR_FILE=file://$CATALINA_BASE/conf/geostore-ovr.properties
  [other variables]
  JAVA_OPTS="-Dgeostore-ovr=$GEOSTORE_OVR_FILE [other opts]"

In this manner you can specify the configuration file path relative to your own CATALINA_BASE.

Make sure your path starts with file:// , otherwise the file will be only searched within the classpath.

If you want more informations about GeoStore externalization you can read this page.