I've tried setting a username in tomcat-users.xml with combination of variable expansion and JAVA_OPTS. However, it does not seem to work as it would for server.xml. Is there a simple way to achieve this?
I saw an example using confd, but feel like there should be a simpler, cleaner solution.
tomcat-users.xml:
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-status"/>
<user name="${USERNAME}_foo" password="" roles="manager-status"/>
</tomcat-users>
JAVA_OPTS:
JAVA_OPTS ="-DUSERNAME=${USERNAME}"