title: Using properties in Wildfly-CLI scripts for if/else Logic
body: <p>In the Wildfly CLI-scripts it is possible to test for existence of a resource and execute some conditional logic:</p>
  
  <pre><code>if (outcome != success) of /subsystem=datasources/xa-data-source=MY_DATASOURCE:read-resource  
  // now do something  
  </code></pre>
  
  <p>When you run the cli, you can provide properties that are available in your scripts like this:</p>
  
  <pre><code>$JBOSS_HOME/bin/jboss-cli.sh --file=my.cli --properties=my.properties  
  </code></pre>
  
  <p>I would like to introduce some conditional logic based on these properties to do some conditional configuration.</p>
  
  <p>One example is that to configure a mail-server, sometimes the mail-server requires a username and a password and in other cases it allows anonymous access. When setting up the mail-server config i would like to be able to have conditional logic like this</p>
  
  <pre><code>if MAILSERVER_USERNAME is defined //confiure mailserver with username password else // configure mailserver without attributes username/password
  </code></pre>
  
  <p>The only thing that I can see that is possible is if I already have added a system-property setting to my standalone-full.xml, i can query it like this:</p>
  
  <pre><code>if (outcome != success) of /system-property=foo:read-resource  
   // now do something  
  </code></pre>
  
  <p>I would like to do something simuilar based on the properties passed in from my.properties.</p>
  
  <p>Is this possible?</p>
  
  <p>Thanks,</p>
  
  <p>Daniel</p>