Home > front end >  how can I set variables in wildfly standalone.xml
how can I set variables in wildfly standalone.xml

Time:04-13

I have to type same ip address more than 6times in standalone.xml

then I wonder is there any way to set this ip as variable so I just have to change once.

is there any way to set a variable in standalone.xml without using env.sh?

I've tried making a tag like this and failed to start wildfly

<variable name="ip_addr" value="192.168.0.24"/>  
...skip...
<interface name="public">
    <inet-address values="${jboss.bind.address:ip_addr}"/>
</interface>
...skip till the end...

CodePudding user response:

There is not variable option to store values in the configuration. The expression pattern is ${system.property.name:default_value}. You could keep the default of ${jboss.bind.address:127.0.0.1} and add a system property for jboss.bind.address with the value of your IP address. With CLI it would look like:

/system-property=jboss.bind.address:add(value=192.168.0.24)

You can also use the web console to add the system property.

Your other option is to set the system property in the JAVA_OPTS in the standlone.conf for Linux based operating systems or standalone.conf.bat for Windows.

export JAVA_OPTS="-Djboss.bind.address=192.168.0.24 $JAVA_OPTS"
  • Related