mde/geddy — pull request #149 by davidsmejia (2012-05-24 00:56:40+00:00)
Title: Mongo Adapter Authentication

Hey guys,

This probably isn't going to be an issue for too many people but I thought it would be nice to add some authentication support for the mongo adapter. Works the same way as before just checks your config for prefix, username, and password to use for connections.

```javascript
// Model string
this.model = config.model;
this.dbName = geddy.config.db.mongo.db;
this.port = geddy.config.db.mongo.port || 27017;
this.host = geddy.config.db.mongo.host || 'localhost';
this.prefix = geddy.config.db.mongo.prefix || null;
this.username = geddy.config.db.mongo.username || null;
this.password = geddy.config.db.mongo.password || null;
// Connect to the DB
this.db = mongo.db(this.host, this.port, this.dbName, this.prefix, this.username, this.password);
```

And in the config file any of the following:

```javascript
config.db = {
host : 'localhost'
, db : 'local'
, port : 27017
};

config.db = {
username : ''
, password : ''
, host : 'localhost'
, db : 'local'
, port : 27017
};

config.db = {
username : 'user'
, password : 'pass'
, host : 'localhost'
, db : 'dbName'
, port : 27012
};

```