Add new type: `:env`
With key aliases it's possible to let ENV['FOO_TEST']
provide for ENVied.FOO
. The env
-type would make it possible to let ENV['FOO_TEST']
provide for ENV['FOO']
. This would enable the key alias for ENV[]
(or ENV.fetch
) in code one doesn't control.
A possible Rails config could look like this:
# file: Envfile
key_alias! { Rails.env }
variable :DATABASE_URL, :env
With the following file sourced, the config/database.yml
could be removed.
# file: .envrc
export DATABASE_URL_DEVELOPMENT=postgres://localhost/blog_development
export DATABASE_URL_TEST=postgres://localhost/blog_test