Skip to content

Commit

Permalink
Merge branch 'vertica:master' into doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sitingren authored Mar 12, 2024
2 parents cb2f2c2 + 5fb374e commit 0960156
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"singleQuote": true
},
"dependencies": {
"vertica-nodejs": "^1.1.2"
"vertica-nodejs": "^1.1.3"
}
}
4 changes: 2 additions & 2 deletions packages/v-pool/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v-pool",
"version": "1.1.2",
"version": "1.1.3",
"description": "Connection pool for Vertica",
"main": "index.js",
"directories": {
Expand Down Expand Up @@ -35,6 +35,6 @@
"mocha": "^7.1.2"
},
"peerDependencies": {
"vertica-nodejs": "1.1.2"
"vertica-nodejs": "1.1.3"
}
}
1 change: 1 addition & 0 deletions packages/vertica-nodejs/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Client extends EventEmitter {
tls_config: this.connectionParameters.tls_config,
tls_mode: this.connectionParameters.tls_mode,
tls_trusted_certs: this.connectionParameters.tls_trusted_certs,
tls_host: this.connectionParameters.host,
keepAlive: c.keepAlive || false,
keepAliveInitialDelayMillis: c.keepAliveInitialDelayMillis || 0,
encoding: this.connectionParameters.client_encoding || 'utf8',
Expand Down
30 changes: 25 additions & 5 deletions packages/vertica-nodejs/lib/connection-parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,32 @@ class ConnectionParameters {
this.workload = val('workload', config, false)

// client auditing information
this.client_os_hostname = os.hostname()
this.client_type = "Node.js Driver"
this.client_version = "1.1.2"
this.client_pid = process.pid.toString()
this.client_os = os.platform()
this.client_os_user_name = os.userInfo().username
this.client_version = "1.1.3"

try {
this.client_os_hostname = os.hostname()
} catch (e) {
this.client_os_hostname = ""
}

try {
this.client_pid = process.pid.toString()
} catch (e) {
this.client_pid = "0"
}

try {
this.client_os = os.platform()
} catch (e) {
this.client_os = ""
}

try {
this.client_os_user_name = os.userInfo().username
} catch (e) {
this.client_os_user_name = ""
}

//NOTE: The client has only been tested to support 3.5, which was chosen in order to include SHA512 support
this.protocol_version = (3 << 16 | 5) // 3.5 -> (major << 16 | minor) -> (3 << 16 | 5) -> 196613
Expand Down
2 changes: 2 additions & 0 deletions packages/vertica-nodejs/lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Connection extends EventEmitter {
//this.tls_client_key = config.tls_client_key
//this.tls_client_cert = config.tls_client_cert
this.tls_trusted_certs = config.tls_trusted_certs
this.tls_host = config.tls_host
}
var self = this
this.on('newListener', function (eventName) {
Expand Down Expand Up @@ -166,6 +167,7 @@ class Connection extends EventEmitter {
else if (self.tls_mode === 'verify-full') { //verify that the name on the CA-signed server certificate matches it's hostname
try {
tls_options.rejectUnauthorized = true
tls_options.host = self.tls_host // Hostname/IP to match certificate's altnames
if (self.tls_trusted_certs) {
tls_options.ca = fs.readFileSync(self.tls_trusted_certs).toString()
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vertica-nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vertica-nodejs",
"version": "1.1.2",
"version": "1.1.3",
"description": "Vertica client - pure javascript & libpq with the same API",
"keywords": [
"database",
Expand Down Expand Up @@ -32,7 +32,7 @@
"pg-types": "^2.1.0",
"pgpass": "1.x",
"v-connection-string": "1.1.0",
"v-pool": "1.1.2",
"v-pool": "1.1.3",
"v-protocol": "1.1.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ suite.test('successful connection', (done) => {
})

suite.test('expired connection timeout', (done) => {
const opts = { ...options, port: 54322 }
const opts = { ...options, port: 5434 }
serverWithConnectionTimeout(opts.port, opts.connectionTimeoutMillis * 2, (closeServer) => {
const timeoutId = setTimeout(() => {
throw new Error('Client should have emitted an error but it did not.')
Expand Down

0 comments on commit 0960156

Please sign in to comment.