mongodb/mongo-ruby-driver — pull request #99 by seamusabshere (2012-05-18 16:32:30+00:00)
Title: Use ENV['MONGODB_URI'] if available

hi,

There's a growing trend to use `_URL`-style environment variables in database drivers:

* [Rails looks for `ENV['DATABASE_URL']`](https://github.com/rails/rails/commit/4605b5639db4fa15f8b6627245c74b899241f38a)
* [The official Redis client uses `ENV['REDIS_URL']`](https://github.com/redis/redis-rb/commit/06b2a58b2ea33112728eae901ed242e7615ebcd7)
* [Dalli uses `ENV['MEMCACHE_SERVERS']`](https://github.com/mperham/dalli/commit/628b2b13d70678ee610ef34014e4caa5389f98a2) - and I will shortly be making a pull request to support `ENV['MEMCACHE_URL']`

Note that I followed the convention already established in the MongoDB code of calling it a "URI" and not a "URL", so that is one difference from the general trend.

Fundamentally, this change will make MongoDB a lot easier to deploy on services like Heroku that encourage environment variables.

Thanks!
Seamus

PS. `rake test:ruby` and `rake test:c` all pass - plus I added more tests.