]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: init: make -cc support environment variables expansion
authorWilly Tarreau <w@1wt.eu>
Fri, 16 Jul 2021 17:14:54 +0000 (19:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 16 Jul 2021 17:18:41 +0000 (19:18 +0200)
I found myself a few times testing some conditoin examples from the doc
against command line's "-cc" to see that they didn't work with environment
variables expansion. Not being documented as being on purpose it looks like
a miss, so let's add PARSE_OPT_ENV and PARSE_OPT_WORD_EXPAND to be able to
test for example -cc "streq(${WITH_SSL},yes)" to help debug expressions.

src/haproxy.c

index 8a9f50cf8c93138183d3625c53065b92aa3dcdb6..2d32bb84f6973599fe8ef89c6994007eef6cb004 100644 (file)
@@ -1808,7 +1808,7 @@ static void init(int argc, char **argv)
                size_t outlen = strlen(check_condition) + 1;
 
                err = parse_line(check_condition, check_condition, &outlen, args, &arg,
-                                PARSE_OPT_DQUOTE | PARSE_OPT_SQUOTE | PARSE_OPT_BKSLASH,
+                                PARSE_OPT_ENV | PARSE_OPT_WORD_EXPAND | PARSE_OPT_DQUOTE | PARSE_OPT_SQUOTE | PARSE_OPT_BKSLASH,
                                 &errptr);
 
                if (err & PARSE_ERR_QUOTE) {