From 8ac7392b443b0d548239d53443d098e09c29908a Mon Sep 17 00:00:00 2001
From: Mohammad Torkashvand <mohammad.torkashvand@geant.org>
Date: Mon, 8 Jan 2024 17:25:21 +0100
Subject: [PATCH] fix linting issue

---
 .env.local.example   | 2 +-
 custom/custom_env.js | 2 +-
 src/utils/policy.ts  | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.env.local.example b/.env.local.example
index 063314a..af5fbea 100644
--- a/.env.local.example
+++ b/.env.local.example
@@ -15,7 +15,7 @@ REACT_APP_OAUTH2_ENABLED=False
 REACT_APP_OAUTH2_CLIENT_ID=
 REACT_APP_OAUTH2_OPENID_CONNECT_URL=
 REACT_APP_OAUTH2_SCOPE=
-REACT_APP_OPA_BUNDLE_URL="http://localhost:8080/opa/bundles/policy.wasm"
+REACT_APP_OPA_BUNDLE_URL=http://localhost:8080/opa/bundles/policy.wasm
 
 # Needed because some libs misbehave
 GENERATE_SOURCEMAP=false
diff --git a/custom/custom_env.js b/custom/custom_env.js
index 2b69ba1..b259cd4 100644
--- a/custom/custom_env.js
+++ b/custom/custom_env.js
@@ -1 +1 @@
-window.__env__.REACT_APP_OPA_BUNDLE_URL = "${REACT_APP_OPA_BUNDLE_URL}";
+window.__env__.OPA_BUNDLE_URL = "${REACT_APP_OPA_BUNDLE_URL}";
diff --git a/src/utils/policy.ts b/src/utils/policy.ts
index 207dab5..7b66cd1 100644
--- a/src/utils/policy.ts
+++ b/src/utils/policy.ts
@@ -6,10 +6,11 @@ export async function createPolicyCheck(user?: Partial<Oidc.Profile>) {
         return () => true;
     }
 
-    const opaBundletUrl = process.env.REACT_APP_OPA_BUNDLE_URL;
+    const opaBundletUrl = process.env.OPA_BUNDLE_URL;
 
     if (typeof opaBundletUrl === 'undefined') {
-        throw new Error('REACT_APP_OPA_BUNDLE_URL is not defined');
+        console.log('OPA_BUNDLE_URL is not defined');
+        return () => true;
     }
 
     const policyResult = await fetch(opaBundletUrl);
-- 
GitLab