Respect SSL setting from connection parameters

This commit is contained in:
Brian Carlson 2013-09-09 11:50:20 -05:00
parent b26a4303a8
commit 1674359b57
2 changed files with 10 additions and 2 deletions

View File

@ -23,14 +23,14 @@ var Client = function(config) {
this.connection = c.connection || new Connection({
stream: c.stream,
ssl: c.ssl
ssl: this.connectionParameters.ssl
});
this.queryQueue = [];
this.binary = c.binary || defaults.binary;
this.encoding = 'utf8';
this.processID = null;
this.secretKey = null;
this.ssl = c.ssl || false;
this.ssl = this.connectionParameters.ssl || false;
};
util.inherits(Client, EventEmitter);

View File

@ -161,4 +161,12 @@ test('libpq connection string building', function() {
assert.equal(subject.ssl, true);
});
test('ssl is set on client', function() {
var Client = require('../../../lib/client')
var defaults = require('../../../lib/defaults');
defaults.ssl = true;
var c = new Client('postgres://user@password:host/database')
assert(c.ssl, 'Client should have ssl enabled via defaults')
})
});