pieter michels

Github    Ask me anything   

February 1, 2011 at 1:54pm

Home

Force ‘Rails.env’ in Phusion Passenger using Capistrano and .htaccess

When deploying your Ruby on Rails project to a shared hosting environment you might run into trouble with the environment variables. By default the environment (<%= Rails.env %>) will be ‘production’.  This is not what you might want when you’re using multiple servers for different environments (eg development, test, staging, production, …).  You can either ask your hosting provider to change this but the little snippet below could be helpful if you want to do it yourself. Mind this: I use Capistrano with a multistage setup (https://github.com/capistrano).

Extra addition is the possibility to set a password (through .htpasswd / .htaccess) for a specific environment upon deploy:

Notes

  1. spokane-jobs reblogged this from pieterm
  2. pieterm posted this