From: William Lallemand Date: Tue, 21 Feb 2023 13:07:05 +0000 (+0100) Subject: MINOR: startup: HAPROXY_STARTUP_VERSION contains the version used to start X-Git-Tag: v2.8-dev5~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4c0be6b20f5365dc00221b51face2a32cf4053b;p=thirdparty%2Fhaproxy.git MINOR: startup: HAPROXY_STARTUP_VERSION contains the version used to start HAPROXY_STARTUP_VERSION: contains the version used to start, in master-worker mode this is the version which was used to start the master, even after updating the binary and reloading. This patch could be backported in every version since it is useful when debugging. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 370b96022c..beae7db870 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -778,6 +778,10 @@ file, or could be inherited by a program (See 3.7. Programs): * HAPROXY_MASTER_CLI: In master-worker mode, listeners addresses of the master CLI, separated by semicolons. +* HAPROXY_STARTUP_VERSION: contains the version used to start, in master-worker + mode this is the version which was used to start the master, even after + updating the binary and reloading. + In addition, some pseudo-variables are internally resolved and may be used as regular variables. Pseudo-variables always start with a dot ('.'), and are the only ones where the dot is permitted. The current list of pseudo-variables is: diff --git a/src/haproxy.c b/src/haproxy.c index 3025d5afe6..308f41873c 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1490,6 +1490,8 @@ static void init_early(int argc, char **argv) char *tmp; int len; + setenv("HAPROXY_STARTUP_VERSION", HAPROXY_VERSION, 0); + /* First, let's initialize most global variables */ totalconn = actconn = listeners = stopping = 0; killed = pid = 0;