Change the data directory

This how-to describes how you can change the path of the data directory of security.manager for OGC.

As explained in the section about security.manager for OGC directories, the path for the data directory by default determines where the configuration files of security.manager for OGC are located and temporary files are stored. However, the default value ${user.home}/.secman-ogc is not suitable in all cases.

You can use the following ways to specify any path for the data directory:

Prerequisites

  • You are running security.manager for OGC in an Apache Tomcat.

  • You have the rights to modify the Tomcat configuration or the security.manager web app directory.

Set path via environment variable

One way to set the path for the data directory is to use the environment variable DATA_DIRECTORY_LOCATION.

For example, to use the path /opt/secman-ogc/data, set the environment variable as follows:

DATA_DIRECTORY_LOCATION=/opt/secman-ogc/data

How you set the Tomcat environment variable depends on your operating system and how you start Tomcat.

The result is that security.manager for OGC now stores temporary data in the directory /opt/secman-ogc/data/temp. In addition, security.manager for OGC uses the path /opt/secman-ogc/data as the configuration directory if you do not set it explicitly.

Set path via custom-application.properties

This method for customizing the data directory requires you to modify the file custom-application.properties in the folder of the unpacked web app. It has the disadvantage that you have to repeat the customization every time you update or reinstall the web app as part of an update of security.manager for OGC.

In the following it is assumed that you have copied the security.manager for OGC web app as a WAR file to the Tomcat webapps folder. If you have installed security.manager for OGC as described in the installation documentation, this is the case.

To set the path /opt/secman-ogc/data as the data directory, for example, proceed as follows:

  1. Locate the directory [TOMCAT]/webapps/secman-ogc/WEB-INF/classes of the security.manager for OGC web app.

  2. Create the file custom-application.properties in the located directory, if it does not already exist.

  3. Add the following line:

    custom-application.properties
    data.directory.location=/opt/secman-ogc/data
  4. Save the file.

  5. Make sure the specified directory exists and contains the necessary configuration files.

  6. Restart Tomcat.

The result is that security.manager for OGC now stores temporary data in the directory /opt/secman-ogc/data/temp. In addition, security.manager for OGC uses the path /opt/secman-ogc/data as the configuration directory if you do not set it explicitly.