Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created October 9, 2014 15:54
Show Gist options
  • Save ajcrites/09bb0c257caac8d42b04 to your computer and use it in GitHub Desktop.
Save ajcrites/09bb0c257caac8d42b04 to your computer and use it in GitHub Desktop.
// Connect to a Mongo replica set using SSL through Mongoose and the power of love
var db = {
dsn: 'mongodb://db1:27017/DB_NAME,mongodb://db2:27017/DB_NAME,mongodb:db3:27017/DB_NAME',
options: {
replset: {
rs_name: 'rs0',
ssl: true,
sslCert: fs.readFileSync("/path/to/file.crt"),
sslKey: fs.readFileSync("/path/to/file.key"),
},
auth: { authdb: "AUTH_DB_NAME" },
user: "username",
pass: "********",
},
};
mongoose.connect(db.dsn, db.options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment