🛠 Logs on ES auth

This commit is contained in:
Montassar Ghanmy
2023-07-12 15:28:03 +01:00
committed by GitHub
parent a11e7bc315
commit 9a495a27d2
@@ -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();
}