HAProxy Enterprise Documentation 2.4r1

set var

Set or overwrite a process-wide variable with the result of an expression or format string.

Description

Set or overwrite a process-wide variable with the result of an expression or format string. Only process-wide variables may be used, so the name must begin with proc.. Other names fail. This command requires a CLI level of operator or admin.

An expression may consist only of internal sample fetch keywords and converters. The command line parser does not recognize quotes, so any space in the expression must be preceded by a backslash.

Examples

Below, we create a process-wide variable called proc.arch and set it to the expression str(arch1):

$ echo "experimental-mode on; set var proc.arch str(arch1)" | \
   sudo socat stdio unix-connect:/var/run/hapee-2.4/hapee-lb.sock

Confirm the operation:

$ echo "experimental-mode on; get var proc.arch" | \
   sudo socat stdio unix-connect:/var/run/hapee-2.7/hapee-lb.sock
proc.arch: type=str value=<arch1>

See also


Next up

set weight