]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: startup: introduce load_cfg and read_cfg
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Fri, 9 Aug 2024 16:29:14 +0000 (18:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
commit0ed262d7bf2b628d620886175605e74d94ec1aa2
treef40097f1bf61ef17a3504d42b223ffd6643eaece
parente2b47682243130b502ff835c6ed2e50b65451738
MEDIUM: startup: introduce load_cfg and read_cfg

This commit is a part of the series to add a support of discovery mode in the
configuration parser and in initialization sequence.

In order to support discovery mode, we need to read the configuration twice.
So, we need to split the stage, when we load all configuration files, from
the stage when we parse it. To do this, let's encapsulate in read_cfg() the
part, where we load the configuration files in a separate function, load_cfg().
Like this we can call only the parsing part as many times as we need.

Before reading configuration at the first time we set MODE_DISCOVERY. After
the reading this mode is immediately unset, as the real runtime mode has been
already set by discovery keywords parsers.

Second read is performed when all primary runtime modes (daemon, master-worker)
are applied, because we should not read the configuration twice in the master
process.
src/haproxy.c