gabriel.birke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Aug-31 20:26 UTC
How to set RAILS_ENV for different directories (fcgid)
Hello! I want to use the same application in two environments (production and development) on the same server (apache2 with fcgid) in different (aliased) directories. Is there a way to specify RAILS_ENV inside my <Directory> directives? I have the line DefaultInitEnv RAILS_ENV production in my httpd.conf but I want one of the directories to be development. Setting the ENV var directly in environment.rb is not an option because I update the production server via SVN but need to keep environment.rb in my repository. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
hamza khan-cheema
2006-Sep-01 10:35 UTC
Re: How to set RAILS_ENV for different directories (fcgid)
Hi, I had the same problem. Unfortunately my solution was to change the environment.rb for the production app. In Apache I have two virtual hosts, and I put the following in the staging defination : SetEnv RAILS_ENV development and in the production host I put : SetEnv RAILS_ENV production But for some reason that does not work. Maybe someone can tell us why this solution does not work. Kind Regards Hamza --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dee Zsombor
2006-Sep-01 10:38 UTC
Re: How to set RAILS_ENV for different directories (fcgid)
gabriel.birke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Hello! > > I want to use the same application in two environments (production and > development) on the same server (apache2 with fcgid) in different > (aliased) directories. > > Is there a way to specify RAILS_ENV inside my <Directory> directives? I > have the line > DefaultInitEnv RAILS_ENV production > in my httpd.conf but I want one of the directories to be development. > > Setting the ENV var directly in environment.rb is not an option because > I update the production server via SVN but need to keep environment.rb > in my repository.You could make the enviroment.rb more dynamic, i.e. compute the value for RAILS_ENV from the current path. A hack but all ruby:> RAILS_ENV = case `hostname`.chomp > when "myserver": /myproduction_dir/.match(File.expand_path(RAILS_ROOT)) ? ''production'' : ''development > else ''development'' > endOr something along these lines. zsombor -- Company - http://primalgrasp.com Thoughts - http://deezsombor.blogspot.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 -~----------~----~----~----~------~----~------~--~---