Heroku, Precompiling Assets and Enviroment Variables

It's easy enough to set up a staging environment on Heroku and have the environment use your staging.rb at runtime by setting the RACK_ENV  variable to "staging".

Currently there is a problem if you need anything from your staging.rb whilst the slug is being compiled. I ran into this when I specified an asset host. At runtime, assets that were referenced in the rails code were fine, but all assets referenced in my stylesheets pointed at the asset host from the production.rb.

With the default set up, environment variables are ignored during slug compilation. There is a setting in heroku labs that will load the variables before slug compilation:

As with anything in labs, there are no guarantees, butI have had no problems so far.

 

Previous
Previous

Scala and SBT set up for the command line on OSX

Next
Next

Creating a staging environment on Heroku