Comparing version 2.5.1 to 2.6.0
@@ -38,2 +38,15 @@ var dns = require('dns'); | ||
var useSsl = function() { | ||
switch(process.env.PGSSLMODE) { | ||
case "disable": | ||
return false; | ||
case "prefer": | ||
case "require": | ||
case "verify-ca": | ||
case "verify-full": | ||
return true; | ||
} | ||
return defaults.ssl; | ||
}; | ||
var ConnectionParameters = function(config) { | ||
@@ -47,3 +60,3 @@ config = typeof config == 'string' ? parse(config) : (config || {}); | ||
this.binary = val('binary', config); | ||
this.ssl = config.ssl || defaults.ssl; | ||
this.ssl = config.ssl || useSsl(); | ||
this.client_encoding = val("client_encoding", config); | ||
@@ -50,0 +63,0 @@ //a domain socket begins with '/' |
@@ -1,2 +0,2 @@ | ||
module.exports = { | ||
var defaults = module.exports = { | ||
// database host defaults to localhost | ||
@@ -39,3 +39,10 @@ host: 'localhost', | ||
client_encoding: "" | ||
client_encoding: "", | ||
ssl: false | ||
}; | ||
//parse int8 so you can get your count values as actual numbers | ||
module.exports.__defineSetter__("parseInt8", function(val) { | ||
require('./types').setTypeParser(20, 'text', val ? parseInt : function(val) { return val; }); | ||
}); |
@@ -38,2 +38,15 @@ var dns = require('dns'); | ||
var useSsl = function() { | ||
switch(process.env.PGSSLMODE) { | ||
case "disable": | ||
return false; | ||
case "prefer": | ||
case "require": | ||
case "verify-ca": | ||
case "verify-full": | ||
return true; | ||
} | ||
return defaults.ssl; | ||
}; | ||
var ConnectionParameters = function(config) { | ||
@@ -47,3 +60,3 @@ config = typeof config == 'string' ? parse(config) : (config || {}); | ||
this.binary = val('binary', config); | ||
this.ssl = config.ssl || defaults.ssl; | ||
this.ssl = config.ssl || useSsl(); | ||
this.client_encoding = val("client_encoding", config); | ||
@@ -50,0 +63,0 @@ //a domain socket begins with '/' |
@@ -39,3 +39,5 @@ var defaults = module.exports = { | ||
client_encoding: "" | ||
client_encoding: "", | ||
ssl: false | ||
}; | ||
@@ -42,0 +44,0 @@ |
@@ -20,3 +20,7 @@ var arrayParser = require(__dirname + "/arrayParser.js"); | ||
} | ||
var year = match[1]; | ||
var isBC = /BC$/.test(isoDate); | ||
var _year = parseInt(match[1], 10); | ||
var isFirstCentury = (_year > 0) && (_year < 100); | ||
var year = (isBC ? "-" : "") + match[1]; | ||
var month = parseInt(match[2],10)-1; | ||
@@ -41,2 +45,3 @@ var day = match[3]; | ||
var tzAdjust = 0; | ||
var date; | ||
if(tZone) { | ||
@@ -58,9 +63,14 @@ var type = tZone[1]; | ||
var utcOffset = Date.UTC(year, month, day, hour, min, seconds, mili); | ||
return new Date(utcOffset - (tzAdjust * 60* 1000)); | ||
date = new Date(utcOffset - (tzAdjust * 60* 1000)); | ||
} | ||
//no timezone information | ||
else { | ||
return new Date(year, month, day, hour, min, seconds, mili); | ||
date = new Date(year, month, day, hour, min, seconds, mili); | ||
} | ||
if (isFirstCentury) { | ||
date.setUTCFullYear(year); | ||
} | ||
return date; | ||
}; | ||
@@ -67,0 +77,0 @@ |
{ | ||
"name": "pg.js", | ||
"version": "2.5.1", | ||
"version": "2.6.0", | ||
"description": "node-postgres without the bindings", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146500
4862
81