Environment variables

List of environment variables understood by WebHare and/or the wh command

Essential environment variables


WebHare installation directory. $WEBHARE_DIR/bin/wh must be the wh command. In docker, this is usually /opt/wh/whtree


WebHare data root. If set, all datadirs are looked up relative to this path. In docker, this is usually /opt/whdata

If not set, WEBHARE_DATAROOT is set to '$WEBHARE_DIR/whdata'. If whdata is a symlink, wh will set WEBHARE_DATAROOT to the expanded symlink. This allows you to specify a 'default' WebHare installation for a checked out soure tree.


The base port number for various connections. If not set, assumed to be 13679. The following ports are offset from this number:


Lock the DTAP stage. Must be one of 'production', 'acceptance', 'test' or 'development'. If not set, configurable in WebHare.


Override the server name


Path to a shell script to execute near the end of the post-start script.


If set, this WebHare is configured a 'restored' installation which may not run tasks with external effects. It can be set to a short explanation about the restore (eg a date).

If WEBHARE_DATAROOT/webhare.restoremode exists, WebHare will read the contents of this file and place it into the WEBHARE_ISRESTORED environment variable. You can verify this behavior by runnning wh dirs and checking the output.


The user currently accessing the server. You should ensure this is set to the user executing commands for proper auditing.


Set if we're running inside a docker environment, and not from a source installation


Current semantic WebHare version number, eg 4.27.0


Unique ID intended to be inherited by all children of a service manager. This can also be used to track orphaned processes, eg on macOS: ps ewwax|grep ' WEBHARE_SERVICEMANAGERID=' | sed -r 's/^([^.]+).*$/\1/; s/^[^0-9]*([0-9]+).*$/\1/'


Our build/run platform. linux or darwin


Which process to invoke for 'node' (needed sometimes to lock in the proper version)



WebHare source directory, if you're running WebHare from source.


Options to pass to node (for options not acceptd by $NODE_OPTIONS)


Directory for temporary files. If not set, $WEBHARE_DATAROOT/tmp will be used.


Maintenance window time offset, in minutes. All tasks with the 'maintenance' timezone will be offset this many minutes.


Additional modulepath to search. Separate by colon (':'). In docker, this is usually /opt/whmodules


If set, no connectinfo will be written to the installationroot. This allows you to run a secondary WebHare installation from the same tree without confusing your text editor.


Override the configuration file passed to PostgreSQL


Points to a script that will be sourced by 'wh' and can filter any command passed to it


If set to node this will enable the experimental JS webserver.


Changing the bindings of internal ports gives you more flexibility to route internal WebHare traffic or to access ports for debugging but may have serious repercussions for security. Be very careful when opening these ports and make sure they are properly firewalled from external traffic


Set the IP address binding for the secure/trusted port (usually 13684). If not set it defaults to localhost. This port is intended for the nginx reverse proxy and allows connections to fake their source port, IP and protocol.


Set the IP address binding for the rescue port (usually 13679). If not set it defaults to localhost. The rescueport hosts an insecure WebHare backend interface. (Pre 5.02, WebHare would us 13688 as its rescue port because 13679 was reserved for the database server)


Set the host (or IP) for the builtin OpenSearch, if enabled. If not set it defaults to



Set debug flags, eg WEBHARE_DEBUG=que to globally enable logging of queue actions. See wh debug listflags for an up to date listof debugflags suppoted by your local installation. To set multiple flags separate them by commas (,).

You can also set custom debug flags for your own modules and check them using IsDebugTagEnabled. These should be prefixed with your modulename and a double colon (:) and documented in your moduledefinition file.

See also profiling for profiling flags


Signals a started service process that it's being invoked by wh service debug


Set to 1 to enable the debugflag for the Chrome headless runner


Set to 1 to allow the WebHare docker to run on ephemeral storage such as overlayfs.


Text to append to the command prompt when using wh shell


If set, enables ANSI color within tests (using the test framework) even if no console is available.


wh testdocker and wh testmodule support some extra variables that are useful in CI environments


A URL whose contents will be sourced by the tests and from which any environment variables starting with TESTFW_ or TESTSECRET_ will be passed on to the CI environment (except for TESTSECRET_SECRETSURL itself). The WEBHARE_DEBUG is also passed to the CI environment. Any environment variables whose name starts with TESTFW_WEBHARE_ or TESTSECRET_WEBHARE_ will be passed as WEBHARE_ to the CI environment. CI scripts should access these variables using GetTestSecret

Keep in mind that the buildscripts will list all the set variables and their contexts in their output (the contents of TESTSECRET_ variables are replaced with xxxxxx here so you can still see whether or not they were properly set)

You need to make sure you fully control and trust whatever the URL points to as any shell code in the script it points to may be executed by the test runner as well.

This variable can be setup as eg a GitLab CI/CD environment variable. Please make sure you protect it !


If set, two separate WebHares are running. This enables some additional tests


The WEBHARE_CI variable is set by testdocker/testmodule to indicate that the current installation is started by CI


The WEBHARE_CI_MODULE variable contains the name of the module being tested by CI. (added in 5.02)

Tips and tricks

Build-time variables

These variables are only used during the WebHare build proces or by 'from source' installations. They have no effect on a running WebHare or on Docker versions


Number of processors to use (the make -j parameter). Estimated based on CPU cores and/or memory if not set.


Set to build debug versions of WebHare C++ components