Parameterize catalog settings

This feature allows to parameterize some of the settings in GeoServer’s catalog.

What we mean with that is that you are able to use a templating mechanism to tailor GeoServer’s settings to the environment in which is run.

For example, you’d want to move the latest changes you’ve made from a GeoServer instance running on machine A to another instance running on machine B but there are some differences in the way the two environments are set up, let’s say the password used to connect to the database is different.

If you simply create a backup of the catalog from instance A and restore it on instance B, the stores configured on the database will not be accessible and the corresponding layers will not work properly.

Another example would be the max number of connections available in the connection pool to the database. You might want to have a different pool configuration in the two environments (maybe GeoServer on machine A is a test instance and GeoServer on machine B is used in production).

To overcome such limitation (to have the environment set up in the exact same way on the source machine and on the destination machine) the ENV parametrization allows you to customize the catalog configuration via the use of a templating system.

First of all to be able to use this feature, set the following flag via system variable to GeoServer’s environment:


Then create a file called in the root of GeoServer’s datadir. This file will contain the definitions for the variables parameterized in the catalog configuration.

Now edit GeoServer’s configuration files of the source machine that you want to be parametric, for example let’s parameterize the URL of a store (this can also be done via GeoServer admin UI):

vim coveragestore.xml


Add a definition for the variable store_url in your

store_url = file:///var/geoserver/store/teststore

Now restart GeoServer and navigate to the store config


As you can see the URL in “Connection Parameters” settings now refers the variable store_url whose value is defined in the file.

Another common use case is parameterizing connection details for a vector datastore. Hostname, credentials and connection pool parameters for the databases tend to change between environments. Once you set the variables in the file, you can configure the Datastore from the GeoServer UI as follows: