Hi,
In my environment.rb I want to pick up a variable called ENV[‘site’]
that should be set by the webserver. Using lighty I could do it, but how
do you achieve this with Apache, mod_proxy_balancer and Mongrel?
Jeroen
Hi,
In my environment.rb I want to pick up a variable called ENV[‘site’]
that should be set by the webserver. Using lighty I could do it, but how
do you achieve this with Apache, mod_proxy_balancer and Mongrel?
Jeroen
On Sat, 2006-09-02 at 08:43 +0200, Jeroen wrote:
Hi,
In my environment.rb I want to pick up a variable called ENV[‘site’]
that should be set by the webserver. Using lighty I could do it, but how
do you achieve this with Apache, mod_proxy_balancer and Mongrel?
Easiest way is to just set it in a mongrel.conf. Just create a file
with:
ENV['site'] = "www.joesfancywidgets.com"
Name it mongrel.conf, and then start your mongrel with:
mongrel_rails start -e production -S mongrel.conf
The mongrel.conf file is loaded before rails or anything else and it is
a ruby script.
Try it out and let me know how it works.
–
Zed A. Shaw
http://mongrel.rubyforge.org/
http://www.lingr.com/room/3yXhqKbfPy8 – Come get help.
Hi Zed,
Hmm, it doesn’t seem to work, no errors but no cigar either. here’s what
I do
ror1:/w/tennis/current$ sudo mongrel_rails start -e production -p 80 -S
config/mongrel.conf
** Starting Mongrel listening at 0.0.0.0:80
** Starting Rails with production environment …
** Rails loaded.
** Loading any Rails specific GemPlugins
** Loading config/mongrel.conf external config script
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no
restart).
** Rails signals registered. HUP => reload (without restart). It might
not work well.
** Mongrel available at 0.0.0.0:80
The idea is that, depending on which Vhost is getting the request,
ENV[‘site’] is set to a particular value. With that value the correct
database, css etc gets loaded.
Jeroen
Zed S. wrote:
On Sat, 2006-09-02 at 08:43 +0200, Jeroen wrote:
Hi,
In my environment.rb I want to pick up a variable called ENV[‘site’]
that should be set by the webserver. Using lighty I could do it, but how
do you achieve this with Apache, mod_proxy_balancer and Mongrel?Easiest way is to just set it in a mongrel.conf. Just create a file
with:ENV[‘site’] = “www.joesfancywidgets.com”
Name it mongrel.conf, and then start your mongrel with:
mongrel_rails start -e production -S mongrel.conf
The mongrel.conf file is loaded before rails or anything else and it is
a ruby script.Try it out and let me know how it works.
–
Zed A. Shaw
http://www.zedshaw.com/
http://mongrel.rubyforge.org/
http://www.lingr.com/room/3yXhqKbfPy8 – Come get help.
Strange, if I do a <%=debug ENV %> in my view I do see an entry for
“SITE” so you’re method works as advertised.
Last line in my environment.rb:
RAILS_DEFAULT_LOGGER.warn(‘SITE:’ + ENV[‘SITE’].inspect)
But this ouputs “SITE: nil” in my production.log
Any ideas?
Jeroen
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs