When porting an application from the Java application server GlassFish to Wildfly I noticed that applications in Wildfly report environment variables as empty, whereas GlassFish reports a value. The application code is the same; the command to retrieve the environment variable is:
System.getenv("MY_ENV_VAR");
I'm on Linux and setting the environment variable in the .bashrc file of the user who launches GlassFish and Wildfly. I've tried adding the variable to the bin/standalone.conf, bin/standalone.sh, and the bin/.jbossclirc files of Wildfly without any success.
Here is a similar unanswered question on the JBoss Forum:
https://developer.jboss.org/thread/229862
Note: an environment variable and system property are not the same thing. A work around would be to rewrite all of my applications to use system properties instead of environment variables, but I'd like to avoid that if possible.