diff --git a/.env.local.example b/.env.local.example index 063314ab0fa9429fe41d439aa9e655e82a6b8309..af5fbea8e6a345650b14636041e99ffc08db7553 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 2b69ba118d2078c4bbab9004e06bb411ed5e966f..b259cd41ed12a7d464a57d2851bf1f4d1e8c52a8 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 207dab582d2d66b411304d162c35e5ba87278790..7b66cd14f5e0b5c48ac806ad0b9fc7925c361483 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);