Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367591 - Support Env variables in XmlConfiguration
Summary: Support Env variables in XmlConfiguration
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 7.6.0.RC0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 7.5.x   Edit
Assignee: Shirley Boulay CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-27 19:08 EST by Greg Wilkins CLA
Modified: 2012-06-17 03:40 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Wilkins CLA 2011-12-27 19:08:52 EST
Support Env variables in XmlConfiguration
Comment 1 Greg Wilkins CLA 2011-12-27 19:25:03 EST
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).
Comment 2 Hugues Malphettes CLA 2011-12-30 20:00:08 EST
Thanks Greg!
Comment 3 Simon CLA 2012-06-17 03:40:42 EDT
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)