-
Feature Request
-
Resolution: Done
-
Minor
-
None
-
None
-
Documentation (Ref Guide, User Guide, etc.)
Conditional expressions are great help for creating generic wildfly configurations with the CLI.
Currently the comparison-operations for the if-expression are limited to
- equal (==)
- not equal (!=)
- lesser than (<)
- not lesser than (>=)
- greater than (>)
- not greater than (<=)
I'd propose an additional comparison operation: a regex based match operation with the symbol ~=
wheras the left operand is a string to match against the right operand which is a regex string.
This would enable a simple way to do feature flag detection via partial regex matches.
The following sequence demonstrates this use case:
-Dfeatures="activemq jgroups"
if (result ~= ".*activemq.*") of /:resolve-expression(expression=${features}) echo configuring activemq end-if if (result ~= ".*jgroups.*") of /:resolve-expression(expression=${features}) echo configuring jgroups end-if if (result ~= ".*postgres.*") of /:resolve-expression(expression=${features}) echo configuring postgres end-if
Example:
-Dfeatures="feature1 feature2" [default@local:9990 /] if (result ~= ".*feature1.*") of /:resolve-expression(expression=${features}) [default@local:9990 /] echo configuring feature1 [default@local:9990 /] end-if configuring feature1 [default@local:9990 /] if (result ~= ".*feature2.*") of /:resolve-expression(expression=${features}) [default@local:9990 /] echo configuring feature2 [default@local:9990 /] end-if configuring feature2 [default@local:9990 /] if (result ~= ".*feature3.*") of /:resolve-expression(expression=${features}) [default@local:9990 /] echo configuring feature3 [default@local:9990 /] end-if [default@local:9990 /]
- is related to
-
JBEAP-14000 Release notes: technical preview: CLI match-comparison operation for "if command"
- Closed
-
JBEAP-14001 CLI guide: technical preview: CLI match regular expression operator for "if command"
- Closed