Skip to content

Commit

Permalink
If no username set in auth then don't use it - this fixes fzaninotto#233
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddentao committed Oct 20, 2014
1 parent d9cc96c commit a71ec11
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ var config = require('config');
var semver = require('semver');

// configure mongodb
mongoose.connect(config.mongodb.connectionString || 'mongodb://' + config.mongodb.user + ':' + config.mongodb.password + '@' + config.mongodb.server +'/' + config.mongodb.database);

var userAuthStr = '';
if (config.mongodb.user) {
userAuthStr = config.mongodb.user + ':' + config.mongodb.password + '@';
}
mongoose.connect(config.mongodb.connectionString || 'mongodb://' + userAuthStr + config.mongodb.server +'/' + config.mongodb.database);
mongoose.connection.on('error', function (err) {
console.error('MongoDB error: ' + err.message);
console.error('Make sure a mongoDB server is running and accessible by this application');
Expand Down

2 comments on commit a71ec11

@chancesmith
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got me up and running, but I'm not able to create my first "check" as shown in the creators vimeo video.

Do I need to do something more with Mongo?

@hiddentao
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that should be good enough.

Please sign in to comment.