Deployment: Best way to switch between test and prod envs


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:

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

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?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs