From 2237c866bcc60c2fb352e401aea2eb1f0f3bd89b Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Fri, 12 Apr 2024 12:59:26 -0400 Subject: [PATCH] Restore certs on healthcheck Signed-off-by: Nicko Guyer --- src/health/health.controller.ts | 17 ++++++++++------- src/utils.ts | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/health/health.controller.ts b/src/health/health.controller.ts index 32b378a..0562fa3 100644 --- a/src/health/health.controller.ts +++ b/src/health/health.controller.ts @@ -37,13 +37,16 @@ export class HealthController { @HealthCheck() readiness() { return this.health.check([ - () => - this.http.pingCheck('ethconnect', `${this.blockchain.baseUrl}/status`, { - auth: { - username: this.blockchain.username, - password: this.blockchain.password, - }, - }), + () => { + const httpOptions = getHttpRequestOptions( + this.blockchain.username, + this.blockchain.password, + ); + return this.http.pingCheck('ethconnect', `${this.blockchain.baseUrl}/status`, { + auth: httpOptions.auth, + httpAgent: httpOptions.httpAgent, + }); + }, ]); } } diff --git a/src/utils.ts b/src/utils.ts index fbcadbc..baa97a8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -46,7 +46,7 @@ export const getWebsocketOptions = (username: string, password: string): ClientO return requestOptions; }; -export const getHttpRequestOptions = (username: string, password: string) => { +export const getHttpRequestOptions = (username: string, password: string): AxiosRequestConfig => { const requestOptions: AxiosRequestConfig = {}; if (username !== '' && password !== '') { requestOptions.auth = {