I am trying to configure my tomcat server.xml and I need to set value to something from an environment variable. I can't seem to find a way around from that.
I know how to use values stored in a properties file but I can't set a variable to use my environment variable in a property file as well. is there a work around? I tried the following:
1 -
.xml file
<Resource
user="${VAR}"
.../>
2 -
<Resource
user="${env.VAR}"
.../>
3 -
.properties file
myVar=${VAR} and then
<Resource
user="${myVar}"
.../>
in my setenv.sh file
export JAVA_OPTS="$JAVA_OPTS -Dmyvar=${VAR}"
now I can use myvar inside a properties file or better, directly within a xml file since the variable is now available with tomcat context
<Resource
user="${myvar}"
.../>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With