-
Notifications
You must be signed in to change notification settings - Fork 137
ENV Isolation
Karol Bucek edited this page Jun 17, 2014
·
2 revisions
You can isolate your Ruby application's environment by clearing out the ENV variable by setting the jruby.runtime.env
context parameter to false
sample web.xml deployment descriptor :
<web-app>
<context-param>
<param-name>jruby.runtime.env</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>jruby.min.runtimes</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<param-name>jruby.max.runtimes</param-name>
<param-value>1</param-value>
</context-param>
<filter>
<filter-name>RackFilter</filter-name>
<filter-class>org.jruby.rack.RackFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RackFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
</listener>
</web-app>
It accepts comma new line separated values as well, to allow for fine grained ENV
customizations :
<context-param>
<param-name>jruby.runtime.env</param-name>
<param-value>
DATABASE_URL=mysql://192.168.1.11/mydb
PATH=/usr/local/bin,HOME=/home/tomcat,NAMES=Jozko, Ferko,Janko,GEM_HOME=""
</param-value>
</context-param>
will end up setting DATABASE_URL
, PATH
, HOME
, NAMES
and GEM_HOME
keys within Ruby runtimes ENV
hash.