]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: cfgparse: implement a simple if/elif/else/endif macro block handler
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Feb 2021 16:59:10 +0000 (17:59 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Feb 2021 17:54:19 +0000 (18:54 +0100)
commit4b10302fd8ff75427ea9af767876b81331c75111
tree4437d04cc2733fd0ccb230c6f5fd80a7f32dc671
parent49962b58d041fe07c92e3156895a381634e11151
MINOR: cfgparse: implement a simple if/elif/else/endif macro block handler

Very often, especially since reg-tests, it would be desirable to be able
to conditionally comment out a config block, such as removing an SSL
binding when SSL is disabled, or enabling HTX only for certain versions,
etc.

This patch introduces a very simple nested block management which takes
".if", ".elif", ".else" and ".endif" directives to take or ignore a block.

For now the conditions are limited to empty string or "0" for false versus
a non-nul integer for true, which already suffices to test environment
variables. Still, it needs to be a bit more advanced with defines, versions
etc.

A set of ".notice", ".warning" and ".alert" statements are provided to
emit messages, often in order to provide advice about how to fix certain
conditions.
doc/configuration.txt
src/cfgparse.c