From 57fe0a6d91eb76c1599c70a9dd57ccbfe9236608 Mon Sep 17 00:00:00 2001 From: hschiau Date: Thu, 6 Feb 2025 14:23:44 +0200 Subject: [PATCH] MEX-682: use gateway url in proxy service --- src/helpers/api.config.service.ts | 8 ++++++++ src/services/multiversx-communication/mx.proxy.service.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/helpers/api.config.service.ts b/src/helpers/api.config.service.ts index f7acb28b5..482db7969 100644 --- a/src/helpers/api.config.service.ts +++ b/src/helpers/api.config.service.ts @@ -132,6 +132,14 @@ export class ApiConfigService { return apiUrl; } + getGatewayUrl(): string { + const gatewayUrl = this.configService.get('MX_GATEWAY_URL'); + if (!gatewayUrl) { + throw new Error('No gatewayUrl present'); + } + return gatewayUrl; + } + getKeepAliveTimeoutDownstream(): number { const keepAliveTimeoutDownstream = this.configService.get( 'KEEPALIVE_TIMEOUT_DOWNSTREAM', diff --git a/src/services/multiversx-communication/mx.proxy.service.ts b/src/services/multiversx-communication/mx.proxy.service.ts index 91e177246..7819209ff 100644 --- a/src/services/multiversx-communication/mx.proxy.service.ts +++ b/src/services/multiversx-communication/mx.proxy.service.ts @@ -41,7 +41,7 @@ export class MXProxyService { this.proxy = new ProxyNetworkProviderProfiler( this.apiConfigService, - this.apiConfigService.getApiUrl(), + this.apiConfigService.getGatewayUrl(), { timeout: mxConfig.proxyTimeout, httpAgent: mxConfig.keepAlive ? httpAgent : null,