If you are running WildFly server as a service under GNU/Linux, setting environment variables under profile.d, bash_rc etc. won't be read. In order for the war to get the environment variable, follow the below steps. Say the variable is APP_PROPERTIES and the path is /opt/config/app.properties.

1. Add the following line in /etc/default/wildfly.conf

APP_PROPERTIES="/opt/config/app.properties"

2. Export the variable in /etc/init.d/wildfly

export APP_PROPERTIES