Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
update for mongo ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon Hall committed Mar 25, 2016
1 parent 7cecb19 commit 42c464f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Config(env) {
var envConfigPath = path.join(CONFDIR, env);

if (!fs.existsSync(envConfigPath)) {
fs.writeFileSync(envConfigPath, JSON.stringify({}, null, 2));
fs.writeFileSync(envConfigPath, JSON.stringify(Config.DEFAULTS, null, 2));
}

config = merge(
Expand All @@ -66,7 +66,8 @@ Config.DEFAULTS = {
name: '__metadisk-test',
user: null,
pass: null,
mongos: false
mongos: false,
ssl: false
},
server: {
host: '127.0.0.1',
Expand Down
3 changes: 2 additions & 1 deletion lib/storage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ Storage.prototype._getConnectionURI = function(_options) {
var proto = 'mongodb://';
var address = _options.host + ':' + _options.port;
var dbname = '/' + _options.name;
var query = _options.ssl ? '?ssl=true' : '';
var creds = _options.user && _options.pass ?
_options.user + ':' + _options.pass + '@' : '';

return [proto, creds, address, dbname].join('');
return [proto, creds, address, dbname, query].join('');
};

/**
Expand Down

0 comments on commit 42c464f

Please sign in to comment.