]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: startup: set HAPROXY_LOCALPEER only once
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 19 Nov 2024 13:22:08 +0000 (14:22 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 20 Nov 2024 14:44:10 +0000 (15:44 +0100)
commitd6ccd1738bae7d56697371fdc09dd3882337e003
tree381370674a87803f06c2607b6fa6b663997d1f15
parent1171a23aec0fdfe73cac02356ec6184241b7e7c3
MINOR: startup: set HAPROXY_LOCALPEER only once

Before this patch HAPROXY_LOCALPEER variable could be set in init_early(),
in init_args() and in cfg_parse_global(). In master-worker mode, if localpeer
keyword set in the global section, HAPROXY_LOCALPEER in the worker
environment is set to this keyword's value, but in the master environment it
still keeps the default, a localhost name. This is confusing.

To fix it, let's set HAPROXY_LOCALPEER only once, when a worker or process in a
standalone mode has finished to parse its configuration. And let's set this
variable only for the worker process or for the process in a standalone mode,
because the master doesn't need it.

HAPROXY_LOCALPEER takes the value saved in localpeer global variable, which is
always set by default in init_early() to the local hostname. Then, localpeer
could be reset in init_args (-L option) and in cfg_parse_global() (while
parsing "localpeer" keyword).
src/cfgparse-global.c
src/haproxy.c