bkeepers/dotenv — pull request #41 by markrebec (2013-06-05 19:27:56+00:00)
Title: Ability to control overriding existing ENV vars

This is a first shot at using a custom gem require to allow configuring whether dotenv will override ENV vars if they're already set.

It's a bit of an awkward solution, but given the fact that something like this needs to be configured before dotenv is loaded, this seems like the best approach.

If being used in rails (`Rails` is defined), then `dotenv-rails` is required, otherwise `dotenv` - if there are any problems with this, maybe we can rethink that piece. Alternately, perhaps checking for rails in the core `dotenv` lib could eliminate the need for `dotenv-rails` altogether?

The railtie has been updated to reverse the order of the env files in the case where overriding is enabled to ensure the same end results.

If you'd like to use something other than a class variable, or would like to abstract this to a config object of some sort, that can be done pretty easily.

This was in reference to https://github.com/bkeepers/dotenv/pull/38 and some of the original thinking behind it is in the comments there. This is just an idea of one way to approach the feature, so feel free to reject the PR if you're not fond of this solution!