Reference Library

PWM Environment

Application Path

The application path is the primary configuration and working directory for an instance of PWM. Each instance of PWM must have its own unique application path. The following contents are stored in the application path directory:

The path value is given as an absolute directory path on the local file system. The PWM application must have full permissions to create, modify and delete folders in this directory. The directory must already be exist when PWM is started, it will not be automatically created.

Older versions of PWM did not require the application path to be set and would automatically use the exploded war directory's WEB-INF directory as the application path. This is no longer done automatically, and having the application path be within the exploded war or anywhere in the application server's directory structure is not recommended.

Setting the Application Path

The following configuration methods are available:

Environment Variable (Recommended)

The application will read the PWM_APPLICATIONPATH variable to determine the location of the application path. Relative paths are not permitted.

Because you set this value at the OS level, it will make maintaining and updating the application easier because you will not need to change anything other than applying a new war file.

Linux Example

export PWM_APPLICATIONPATH='/home/user/pwm-data'

This environment variable would typically be set as part of an init or other script file that starts your application server.

Windows Example

set "PWM_APPLICATIONPATH=c:\pwm-data"

This environment variable is typically set as part of a .bat file that starts your application server, or possibly as a system-wide environment variable via the windows control panel.


Java System Property

The application will read the java system property pwm.applicationPath variable to determine the location of the application path. Relative paths are not permitted. These example parameters would be added to the java command line that starts the application server (tomcat) and java process.

Linux Example

-Dpwm.applicationPath='/home/user/pwm-data'

Windows Example

-Dpwm.applicationPath="c:\pwm-data"

Servlet web.xml

Modify the servlet WEB-INF/web.xml file. You must modify the application war file to accomplish this method. This method accommodates multiple applications on a single application server. File paths must be absolute.

This method is not recommended because updates to the WAR will overwrite the web.xml and you will need to re-apply any changes.

Linux Example

<context-param>
   <description>...</description>
   <param-name>applicationPath</param-name>
   <param-value>/home/user/pwm-data</param-value>
</context-param>

Windows Example

<context-param>
   <description>...</description>
   <param-name>applicationPath</param-name>
   <param-value>c:\pwm-data</param-value>
</context-param>

Linux Example

export PWM_APPLICATIONFLAGS='ManageHttps,NoFileLock'

Property Names and Servlet Context

The environment variables and system properties listed above, such as PWM_APPLICATIONPATH and pwm.applicationPath assume the default context name of /pwm is used.

Context

Java System Property Name

Environment Variable Name

/pwmpwm.applicationPath
or
pwm.pwm.applicationPath
PWM_APPLICATIONPATH
or
PWM_PWM_APPLICATIONPATH
/acmepwm.acme.applicationPathPWM_ACME_APPLICATIONPATH
/acme2pwm.acme2.applicationPathPWM_ACME2_APPLICATIONPATH

In case of conflict, the application path parameters are evaluated in the following order.

  1. Servlet web.xml
  2. Java System Property
  3. Environment Variable (Recommended)

Other PWM Environment Properties

The applicationPath property is just one of many that can be set. The following properties also exist, and are set the same way as the applicationPath describe above. Additionally, properties can also be set using a application.properties file in the root of the applicationPathdirectory, though in that case the keys do not need a context prefix.

Flag

Behavior

applicationPathRoot of the application path directory as discussed above.
ManageHttpsEnable the setting category HTTPS Server
NoFileLockDisable the file lock in the application path directory.
InstanceIDOverride the default random-generated InstanceID value