[Rails] Deployment: Best way to switch between test and prod envs.

Wes Gamble weyus at att.net
Tue Aug 8 22:34:52 GMT 2006


All,

Not looking for advice on the relative wisdom of my actions :).

I have a Rails app. running under Apache 2/fastcgi that I would like to 
switch from using the test environment (database) to using the 
production environment (database).

I can do this by hand by modifying my xx_mod_fastcgi.conf file and 
setting RAILS_ENV to be the appropriate value in the command that 
initializes my dispatch.fcgi processes.

However, I'd like something a little more flexible than that so I can 
switch back and forth with more ease.

Obviously, I can do a symlink thing with the mod_fastcgi.conf file, but 
I was thinking, can I access OS level environment variables directly 
from Apache and use their values in an Apache config file?

Like this:

<IfModule mod_fastcgi.c>
  FastCgiIpcDir /tmp/fcgi_ipc
  FastCgiServer /var/www/html/eSimplyTest/public/dispatch.fcgi \
        -initial-env RAILS_ENV=${CUSTOM_ENV_VAR} \
        -processes 15 -idle-timeout 300
</IfModule>

I'd like to be able to set CUSTOM_ENV_VAR in the shell and have it be 
seen by Apache.

Anybody know how to do that?

Thanks,
Wes

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list