]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: add HAPROXY_BRANCH environment variable
authorSébaastien Gross <sgross@haproxy.com>
Thu, 23 Feb 2023 17:54:25 +0000 (12:54 -0500)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Feb 2023 08:45:44 +0000 (09:45 +0100)
This patch adds support from HAPROXY_BRANCH environment variable.
It can be useful is some resources are loaded from different
locations when migrating from one version to another.

Signed-off-by: Sébastien Gross <sgross@haproxy.com>
doc/configuration.txt
src/haproxy.c

index beae7db870913e9acdb8def2db3bd1b85cf07bf6..fbe598e8f59d48e729e575de891c93ec5695e167 100644 (file)
@@ -782,6 +782,11 @@ file, or could be inherited by a program (See 3.7. Programs):
   mode this is the version which was used to start the master, even after
   updating the binary and reloading.
 
+* HAPROXY_BRANCH: contains the HAProxy branch version (such as "2.8"). It does
+  not contain the full version number. It can be useful in case of migration
+  if resources (such as maps or certificates) are in a path containing the
+  branch number.
+
 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:
index a1399f9dc0d84d2ec154b14fd4fa2660288889ef..eb490804a0bab97d3627517b3d7bc8179ec61f54 100644 (file)
@@ -2090,6 +2090,7 @@ static void init(int argc, char **argv)
                setenv("HAPROXY_HTTP_LOG_FMT", default_http_log_format, 1);
                setenv("HAPROXY_HTTPS_LOG_FMT", default_https_log_format, 1);
                setenv("HAPROXY_TCP_LOG_FMT", default_tcp_log_format, 1);
+               setenv("HAPROXY_BRANCH", PRODUCT_BRANCH, 1);
                list_for_each_entry(wl, &cfg_cfgfiles, list) {
                        int ret;
 
@@ -2116,6 +2117,7 @@ static void init(int argc, char **argv)
                        }
                }
                /* remove temporary environment variables. */
+               unsetenv("HAPROXY_BRANCH");
                unsetenv("HAPROXY_HTTP_LOG_FMT");
                unsetenv("HAPROXY_HTTPS_LOG_FMT");
                unsetenv("HAPROXY_TCP_LOG_FMT");