Community
Participate
Working Groups
Support Env variables in XmlConfiguration
I have implemented this with the new tag "Env" that will be in 7.6 onwards. An example is: <Env name="HOME"/> which expands to the string value of the HOME environment variable. You can also have a default value if HOME is not set: <Env name="HOME" default="value"/> The Env element can be used anywhere a value is expected (just like the SystemProperty element).
Thanks Greg!
Can we have an example please? You show how to define it but how to use it to set something like the --host option to get the server to bind to the correct interface on a cloud platform? I am trying to use this feature with jetty-runner version 7.6.4.v20120524 and it gives an error that the xml syntax is unknown: 2012-06-17 08:30:51.340:WARN:oejx.XmlConfiguration:Config error at <Env name="INTERFACE" default="1.2.3.4"/> java.lang.IllegalStateException: Unknown tag: Env java.lang.IllegalStateException: Unknown tag: Env at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:394) at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:320) at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:279) at org.mortbay.jetty.runner.Runner.configure(Runner.java:263) at org.mortbay.jetty.runner.Runner.main(Runner.java:624)