From 56177052a0acc86710d35d35e3b349b30a24eff1 Mon Sep 17 00:00:00 2001 From: Dmitry Neverovski Date: Tue, 28 Nov 2023 11:20:07 +0100 Subject: [PATCH] fix: use TLS or SSL depending on ES version --- lib.js | 2 +- test/unit.test.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib.js b/lib.js index 621f8e4..d99e1c4 100644 --- a/lib.js +++ b/lib.js @@ -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) { diff --git a/test/unit.test.js b/test/unit.test.js index ee206da..3f2127c 100644 --- a/test/unit.test.js +++ b/test/unit.test.js @@ -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: () => {} } @@ -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: () => {} } @@ -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: () => {} }