Skip to content

Commit

Permalink
fix: use TLS or SSL depending on ES version
Browse files Browse the repository at this point in the history
  • Loading branch information
neverovski authored and jsumners committed Dec 8, 2023
1 parent 5e5b0d9 commit 5617705
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function pinoElasticSearch (opts = {}) {
node: opts.node,
auth: opts.auth,
cloud: opts.cloud,
ssl: { rejectUnauthorized: opts.rejectUnauthorized, ...opts.tls }
tls: { rejectUnauthorized: opts.rejectUnauthorized, ...opts.tls }
}

if (opts.caFingerprint) {
Expand Down
6 changes: 3 additions & 3 deletions test/unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ test('make sure deprecated `rejectUnauthorized` is passed to client constructor'
const rejectUnauthorized = true

const Client = function (config) {
t.equal(config.ssl.rejectUnauthorized, rejectUnauthorized)
t.equal(config.tls.rejectUnauthorized, rejectUnauthorized)
}

Client.prototype.diagnostic = { on: () => {} }
Expand All @@ -477,7 +477,7 @@ test('make sure `tls.rejectUnauthorized` is passed to client constructor', (t) =
const tls = { rejectUnauthorized: true }

const Client = function (config) {
t.equal(config.ssl.rejectUnauthorized, tls.rejectUnauthorized)
t.equal(config.tls.rejectUnauthorized, tls.rejectUnauthorized)
}

Client.prototype.diagnostic = { on: () => {} }
Expand All @@ -499,7 +499,7 @@ test('make sure `tls.rejectUnauthorized` overrides deprecated `rejectUnauthorize
const tls = { rejectUnauthorized: false }

const Client = function (config) {
t.equal(config.ssl.rejectUnauthorized, tls.rejectUnauthorized)
t.equal(config.tls.rejectUnauthorized, tls.rejectUnauthorized)
}

Client.prototype.diagnostic = { on: () => {} }
Expand Down

0 comments on commit 5617705

Please sign in to comment.