MINOR: config: add predicate "feature" to detect certain built-in features
The "feature(name)" predicate will return true if <name> corresponds to
a name listed after a '+' in the features list, that is it was enabled at
build time with USE_<name>=1. Typical use cases will include OPENSSL, LUA
and LINUX_SPLICE. But maybe it will also be convenient to use with optional
addons such as PROMEX and the device detection modules to help keeping the
same configs across various deployments.
diff --git a/doc/configuration.txt b/doc/configuration.txt
index 4242e01..5f60507 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -814,6 +814,10 @@
- defined(<name>) : returns true if an environment variable <name>
exists, regardless of its contents
+ - feature(<name>) : returns true if feature <name> is listed as present
+ in the features list reported by "haproxy -vv"
+ (which means a <name> appears after a '+')
+
- streq(<str1>,<str2>) : returns true only if the two strings are equal
- strneq(<str1>,<str2>) : returns true only if the two strings differ
@@ -830,7 +834,9 @@
.endif
.if streq("$WITH_SSL",yes)
+ .if feature(OPENSSL)
bind :443 ssl crt ...
+ .endif
.endif
Three other directives are provided to report some status: