Merge pull request #28 from hjr3/ssl-parsing

ssl=0 is now parses to false
This commit is contained in:
Herman J. Radtke III 2019-05-23 14:29:22 -07:00 committed by GitHub
commit d7b96e6f44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,10 @@ function parse(str) {
config.ssl = true;
}
if (config.ssl === '0') {
config.ssl = false;
}
if (config.sslcert || config.sslkey || config.sslrootcert) {
config.ssl = {};
}

View File

@ -150,6 +150,12 @@ describe('parse', function(){
subject.ssl.should.equal(true);
});
it('configuration parameter ssl=0', function(){
var connectionString = 'pg:///?ssl=0';
var subject = parse(connectionString);
subject.ssl.should.equal(false);
});
it('set ssl', function () {
var subject = parse('pg://myhost/db?ssl=1');
subject.ssl.should.equal(true);