2.3. Environment variables

  1. HAProxy's configuration supports environment variables. Those variables are
  2. interpreted only within double quotes. Variables are expanded during the
  3. configuration parsing. Variable names must be preceded by a dollar ("$") and
  4. optionally enclosed with braces ("{}") similarly to what is done in Bourne
  5. shell. Variable names can contain alphanumerical characters or the character
  6. underscore ("_") but should not start with a digit.

Example:

  1. bind "fd@${FD_APP1}"
  2. log "${LOCAL_SYSLOG}:514" local0 notice # send to local server
  3. user "$HAPROXY_USER"
  1. Some variables are defined by HAProxy, they can be used in the configuration
  2. file, or could be inherited by a program (See 3.7. Programs):
  3.  
  4. * HAPROXY_LOCALPEER: defined at the startup of the process which contains the
  5. name of the local peer. (See "-L" in the management guide.)
  6.  
  7. * HAPROXY_CFGFILES: list of the configuration files loaded by HAProxy,
  8. separated by semicolons. Can be useful in the case you specified a
  9. directory.
  10.  
  11. * HAPROXY_MWORKER: In master-worker mode, this variable is set to 1.
  12.  
  13. * HAPROXY_CLI: configured listeners addresses of the stats socket for every
  14. processes, separated by semicolons.
  15.  
  16. * HAPROXY_MASTER_CLI: In master-worker mode, listeners addresses of the master
  17. CLI, separated by semicolons.
  18.  
  19. See also "external-check command" for other variables.