Envconfig: Environmentally friendly Ruby configuration
blog.broadstack.com
blog.broadstack.com
.env and envconfig work very well together.
envconfig reads Ruby's ENV and exposes it as a useful configuration object. envconfig-rails uses that to e.g. push the SMTP settings into ActionMailer.
The key value, though, is that envconfig knows about Heroku and Broadstack add-on ENV names.
e.g. when you add the MemCachier Addon, it simply puts MEMCACHIER_SERVERS, MEMCACHIER_USERNAME, MEMCACHIER_PASSWORD into your ENV. Envconfig knows those var names, and assigns them to the memcached service.
If you looks at the various provider mappings in e.g. https://github.com/broadstack/envconfig/blob/master/lib/envc... you'll see that it knows about ENV-provided, and static, configuration for each provider.