From 9a495a27d27ffe6b830209122e5d6debdc6f52f3 Mon Sep 17 00:00:00 2001 From: Montassar Ghanmy Date: Wed, 12 Jul 2023 15:28:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Logs=20on=20ES=20auth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/adapters/elasticsearch/index.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tdrive/backend/node/src/core/platform/services/search/adapters/elasticsearch/index.ts b/tdrive/backend/node/src/core/platform/services/search/adapters/elasticsearch/index.ts index 5f594ca4..9becaa96 100644 --- a/tdrive/backend/node/src/core/platform/services/search/adapters/elasticsearch/index.ts +++ b/tdrive/backend/node/src/core/platform/services/search/adapters/elasticsearch/index.ts @@ -40,7 +40,7 @@ export default class ElasticSearch extends SearchAdapter implements SearchAdapte public async connect() { try { - const clientOptions: any = { + let clientOptions: any = { node: this.configuration.endpoint, ssl: { rejectUnauthorized: false, @@ -48,6 +48,7 @@ export default class ElasticSearch extends SearchAdapter implements SearchAdapte }; if (this.configuration.useAuth) { + logger.info(`Using auth for ES client`); clientOptions.auth = { username: this.configuration.username, password: this.configuration.password, @@ -56,7 +57,19 @@ export default class ElasticSearch extends SearchAdapter implements SearchAdapte this.client = new Client(clientOptions); } catch (e) { - logger.error(`Unable to connect to ElasticSearch at ${this.configuration.endpoint}`); + logger.error( + `Unable to connect to ElasticSearch for options: ${JSON.stringify({ + node: this.configuration.endpoint, + auth: { + useAuth: this.configuration.useAuth, + username: this.configuration.username, + password: this.configuration.password, + }, + ssl: { + rejectUnauthorized: false, + }, + })} at: ${this.configuration.endpoint}`, + ); } this.startBulkReader(); }