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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 Shaw 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.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---