pg 8.0.3 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,11 +11,9 @@ var net = require('net')
11
11
  var EventEmitter = require('events').EventEmitter
12
12
  var util = require('util')
13
13
 
14
- // eslint-disable-next-line
15
- const { parse, serialize } = require('../../pg-protocol/dist')
14
+ const { parse, serialize } = require('pg-protocol')
16
15
 
17
- // TODO(bmc) support binary mode here
18
- // var BINARY_MODE = 1
16
+ // TODO(bmc) support binary mode at some point
19
17
  console.log('***using faster connection***')
20
18
  var Connection = function (config) {
21
19
  EventEmitter.call(this)
@@ -25,7 +25,7 @@ var val = function (key, config, envVar) {
25
25
  return config[key] || envVar || defaults[key]
26
26
  }
27
27
 
28
- var useSsl = function () {
28
+ var readSSLConfigFromEnvironment = function () {
29
29
  switch (process.env.PGSSLMODE) {
30
30
  case 'disable':
31
31
  return false
@@ -34,6 +34,8 @@ var useSsl = function () {
34
34
  case 'verify-ca':
35
35
  case 'verify-full':
36
36
  return true
37
+ case 'no-verify':
38
+ return { rejectUnauthorized: false }
37
39
  }
38
40
  return defaults.ssl
39
41
  }
@@ -68,7 +70,14 @@ var ConnectionParameters = function (config) {
68
70
  })
69
71
 
70
72
  this.binary = val('binary', config)
71
- this.ssl = typeof config.ssl === 'undefined' ? useSsl() : config.ssl
73
+
74
+ this.ssl = typeof config.ssl === 'undefined' ? readSSLConfigFromEnvironment() : config.ssl
75
+
76
+ // support passing in ssl=no-verify via connection string
77
+ if (this.ssl === 'no-verify') {
78
+ this.ssl = { rejectUnauthorized: false }
79
+ }
80
+
72
81
  this.client_encoding = val('client_encoding', config)
73
82
  this.replication = val('replication', config)
74
83
  // a domain socket begins with '/'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg",
3
- "version": "8.0.3",
3
+ "version": "8.1.0",
4
4
  "description": "PostgreSQL client - pure javascript & libpq with the same API",
5
5
  "keywords": [
6
6
  "database",
@@ -21,8 +21,8 @@
21
21
  "dependencies": {
22
22
  "buffer-writer": "2.0.0",
23
23
  "packet-reader": "1.0.0",
24
- "pg-connection-string": "0.1.3",
25
- "pg-pool": "^3.1.1",
24
+ "pg-connection-string": "^2.2.2",
25
+ "pg-pool": "^3.2.0",
26
26
  "pg-protocol": "^1.2.2",
27
27
  "pg-types": "^2.1.0",
28
28
  "pgpass": "1.x",
@@ -46,5 +46,5 @@
46
46
  "engines": {
47
47
  "node": ">= 8.0.0"
48
48
  },
49
- "gitHead": "35328807e3612cb267bee86dccb2551ad186624a"
49
+ "gitHead": "3f5bc58a86cda3b4812addc1e42a06d61d31e614"
50
50
  }