How can I use environment/system variables in tomcat server.xml, context.xml, etc configuration files?
I tried to use ${ENV_VAR_NAME} (both for environm
Environment variables can be referenced in the server.xml etc by setting the system property org.apache.tomcat.util.digester.PROPERTY_SOURCE to the value org.apache.tomcat.util.digester.Digester$EnvironmentPropertySource.
That system property has been available since 7.0, but EnvironmentPropertySource was not mentioned in the doc until 8.5.
https://tomcat.apache.org/tomcat-9.0-doc/config/systemprops.html
Update (April 2020):
The latest tomcat releases (9.0.34, 8.5.54) now support property replacement in most configuration files: https://tomcat.apache.org/tomcat-9.0-doc/changelog.html#Tomcat_9.0.34_(markt)