Le 20/10/2022 à 15:55, Nick Gearls a écrit :
Hello,
It would sometimes be very handy to be able to define a variable (like
-D on command-line or "Define xxx" in the config) inside a module.
This would, for instance, allow to have a config file based on a
define from the module, knowing if the new syntax is known or not, etc.
Concrete example: in mod_security2, they introduced a new "collection".
If you use this collection in an old version, it's a syntax error.
If mod_security2 defines the variable "support_new_collection" (OK,
very bad name obviously), then we can enclose the rule using a
"<IfDefine support_new_collection>.
Would it be possible to export a function to define such a variable?
Thanks
Hi,
Maybe this would not be super-clean, but the module could define some
(useless) directives (i.e. MOD_SEC2_HAS_NEW_COLLECTION_SUPPORT) and
config files could be tweaked with <IfDirective>.
This should work as-is without any new code.
Does it match your use-case?
CJ