ddollar/redis-url — pull request #8 by hunterloftis (2014-10-10 22:02:02+00:00)
Title: username should not be used to select database

redis-url won't work with cloud providers like Heroku's RedisCloud because it treats the (ignorable) username as the database name. Thus:

`REDISCLOUD_URL='redis://rediscloud:sadfsfsdfsdf@pub-redis-1234.us-east-1-4.3.ec2.garantiadata.com:1234'`

... tries to connect to database 'rediscloud' instead of database '0' as would be expected. This patch ignores the username and defaults to db 0 when a database hasn't been supplied like:

`REDISCLOUD_URL='redis://rediscloud:sadfsfsdfsdf@pub-redis-1234.us-east-1-4.3.ec2.garantiadata.com:1234/1'`

A full working example can be seen here:

- https://github.com/heroku-examples/node-articles-nlp/blob/master/script/reset#L11
- https://github.com/heroku-examples/node-articles-nlp/blob/master/package.json#L36