I've got the following configuration line in my production.rb environment file, as instructed in this article:
config.cache_store = :mem_cache_store, ENV["MEMCACHEDCLOUD_SERVERS"].split(','), { :username => ENV["MEMCACHEDCLOUD_USERNAME"], :password => ENV["MEMCACHEDCLOUD_PASSWORD"] }
But when I try to deploy, I'll get an error:
Running: rake assets:precompile rake aborted!
undefined methodsplit' for nil:NilClass
block in '
/tmp/build_abdc.../config/environments/production.rb:107:in
This is because config vars are not available during compilation. There's a Heroku labs add-on that you can supposedly use to remedy this, but it comes with a warning from Heroku that "Using this labs feature is considered counter to Heroku best practices."
So then what is the best practice when it comes to using ENV vars in production config? Should they just all be wrapped in rescue handlers so that Heroku ignores them during compilation?