From 813f012e2854c2d18ca9c1cdc7700c41e1c9cf42 Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Tue, 19 Dec 2023 17:25:49 +0530 Subject: [PATCH] :rocket: Added Gateway URL to environment. --- lib/app-setup/root.tsx | 3 +++ lib/configs/base-url.cjs | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/app-setup/root.tsx b/lib/app-setup/root.tsx index 423888f2a..dc8ca64b2 100644 --- a/lib/app-setup/root.tsx +++ b/lib/app-setup/root.tsx @@ -219,6 +219,9 @@ export const loader = () => { ...(process.env.URL_SUFFIX ? { URL_SUFFIX: process.env.URL_SUFFIX } : {}), ...(process.env.BASE_URL ? { BASE_URL: process.env.BASE_URL } : {}), + ...(process.env.GATEWAY_URL + ? { GATEWAY_URL: process.env.GATEWAY_URL } + : {}), }; }; diff --git a/lib/configs/base-url.cjs b/lib/configs/base-url.cjs index c15a98b73..c80fda6f8 100644 --- a/lib/configs/base-url.cjs +++ b/lib/configs/base-url.cjs @@ -26,8 +26,17 @@ const baseUrls = () => { return process.env.COOKIE_DOMAIN; })() || '.kloudlite.io'; + const gatewayUrl = + (() => { + if (typeof window !== 'undefined') { + // @ts-ignore + return window.GATEWAY_URL; + } + return process.env.GATEWAY_URL; + })() || 'http://gateway-api.kl-core.svc.cluster.local'; + return { - gatewayUrl: 'http://gateway-api.kl-core.svc.cluster.local', + gatewayUrl, authBaseUrl: `https://auth${postFix}.${bUrl}`, consoleBaseUrl: `https://console${postFix}.${bUrl}`, cookieDomain,