How to read operating-system environment variables from JBoss EAP 6/7 configuration files?
Issue
-
Is it possible to read OS environment variables in EAP 6 configuration files
standalone.xml
,domain.xml
andhost.xml
? -
For example, I would like to read OS environment variable
HOSTNAME
and set it to the followinginet-address
:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
I understand I can set OS environment variables via the java system properties in command line like:
./standalone.sh -b $HOSTNAME -bmanagement $HOSTNAME
But I would like to achieve this without specifying OS environment variables via command line.
- Can I use these in the XML configurations so that we don't have to update the loopbacks manually?
<interfaces>
<interface name="public">
<inet-address value="${jboss.bind.address:jboss.bind.localhost}"/>
</interface>
</interfaces>
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
- 7.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.