From f539f7543de3cb21df4b1cdc599a9c941ef33007 Mon Sep 17 00:00:00 2001 From: Abhishek Katiyar Date: Wed, 27 May 2020 12:04:56 +0530 Subject: [PATCH] [ch11577] | Abhishek | Make backend URL an environment variable --- config.js | 1 + docker-compose.yaml | 3 ++- src/AppConfig.d.ts | 1 + src/components/manifest/Form.tsx | 3 +-- src/components/manifest/ShowDeploymentManifest.tsx | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.js b/config.js index a7b5b94..e1ef479 100644 --- a/config.js +++ b/config.js @@ -4,4 +4,5 @@ window.config = { CLIENT_ID: '0oaa0a9up1F7lQc5A4x6', SCOPE: 'openid groups', RESPONSE_TYPE: 'id_token', + BACKEND_URL: 'https://deployment-portal-backend.np.navi-tech.in' } diff --git a/docker-compose.yaml b/docker-compose.yaml index a6fa6f1..faa09f6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,4 +10,5 @@ services: - REDIRECT_URI=http://localhost:3000/implicit/callback - CLIENT_ID=0oaa0a9up1F7lQc5A4x6 - SCOPE=openid groups - - RESPONSE_TYPE=id_token \ No newline at end of file + - RESPONSE_TYPE=id_token + - BACKEND_URL=https://deployment-portal-backend.np.navi-tech.in \ No newline at end of file diff --git a/src/AppConfig.d.ts b/src/AppConfig.d.ts index 624cbaa..cee206d 100644 --- a/src/AppConfig.d.ts +++ b/src/AppConfig.d.ts @@ -1,5 +1,6 @@ export interface AppConfig { ISSUER: string, + BACKEND_URL: string, REDIRECT_URI: string, RESPONSE_TYPE: string, SCOPE: string, diff --git a/src/components/manifest/Form.tsx b/src/components/manifest/Form.tsx index 4673d5f..6b25d26 100644 --- a/src/components/manifest/Form.tsx +++ b/src/components/manifest/Form.tsx @@ -50,8 +50,7 @@ const Form = () => { const handleSubmit = async (values: any ): Promise => { console.log(values); - - fetch('http://localhost:9090/manifest', { + fetch(`${window.config.BACKEND_URL}/manifest`, { method: 'POST', headers: { Accept: 'application/json', diff --git a/src/components/manifest/ShowDeploymentManifest.tsx b/src/components/manifest/ShowDeploymentManifest.tsx index ef1dce3..2fc6176 100644 --- a/src/components/manifest/ShowDeploymentManifest.tsx +++ b/src/components/manifest/ShowDeploymentManifest.tsx @@ -52,7 +52,7 @@ const ShowDeploymentManifest = () => { console.log("...." + serviceName + environment); const {idToken} = authState; fetch( - `http://localhost:9090/manifest/${serviceName}/${environment}`, + `${window.config.BACKEND_URL}/manifest/${serviceName}/${environment}`, { method: 'GET', headers: {