The crew discovered today how to include Heroku config variables in the settings.yml file. It was working for simple constants like 10, but was crashing the app when the constant was something more complex, like a URL.

There are a lot of reasons to deploy Heroku apps with certain constants in Heroku’s config variables. Keeping passwords or backoffice urls out of the source code is one reason. Or if you deploy the same source code to multiple Heroku instances, such as a staging server.

Suppose you have a Heroku config variable called MYAPP_FOO.

This works ‘sometimes’:

# settings.yml:  
my_foo_simple: < %= ENV['MYAPP_FOO'] %>

However, if MYAPP_FOO is a url such as http://mydomain/mypath/ it will crash your app.

This works ‘always’:

# settings.yml:  
my_foo_simple: "< %= ENV['MYAPP_FOO'] %>"