File tree Expand file tree Collapse file tree 3 files changed +20
-18
lines changed
Expand file tree Collapse file tree 3 files changed +20
-18
lines changed Original file line number Diff line number Diff line change 1- REACT_APP_KEYCLOAK_CLIENT = met-web
2- REACT_APP_KEYCLOAK_REALM = met
3- REACT_APP_KEYCLOAK_URL = https://met-oidc- dev.apps.gold.devops .gov.bc.ca/auth
4- REACT_APP_API_URL = https://met -web-dev.apps.gold.devops.gov.bc.ca/api
1+ REACT_APP_KEYCLOAK_CLIENT = epic-engage
2+ REACT_APP_KEYCLOAK_REALM = eao-epic
3+ REACT_APP_KEYCLOAK_URL = https://dev.loginproxy .gov.bc.ca/auth
4+ REACT_APP_API_URL = https://epic-engage -web-dev.apps.gold.devops.gov.bc.ca/api
Original file line number Diff line number Diff line change 1- import { hasKey } from 'utils' ;
1+ import { ITenantDetail } from 'constants/types' ;
2+
23declare global {
34 interface Window {
45 _env_ : {
@@ -30,14 +31,17 @@ declare global {
3031 //tenant
3132 REACT_APP_IS_SINGLE_TENANT_ENVIRONMENT : string ;
3233 REACT_APP_DEFAULT_TENANT : string ;
34+
35+ [ key : string ] : string ;
3336 } ;
3437 }
3538}
3639
37- const getEnv = ( key : string , defaultValue = '' ) => {
38- if ( hasKey ( window . _env_ , key ) ) {
40+ export const getEnv = ( key : string , defaultValue = '' ) : string => {
41+ if ( typeof window !== 'undefined' && window . _env_ && window . _env_ [ key ] !== undefined ) {
3942 return window . _env_ [ key ] ;
40- } else return process . env [ key ] || defaultValue ;
43+ }
44+ return process . env [ key ] || defaultValue ;
4145} ;
4246
4347// adding localStorage to access the MET API from external sources(eg: web-components)
@@ -112,3 +116,9 @@ export const AppConfig = {
112116 defaultTenant : DEFAULT_TENANT ,
113117 } ,
114118} ;
119+
120+ export const getTenantDetail = ( ) : ITenantDetail => ( {
121+ realm : getEnv ( 'REACT_APP_KEYCLOAK_REALM' ) ,
122+ url : getEnv ( 'REACT_APP_KEYCLOAK_URL' ) ,
123+ clientId : getEnv ( 'REACT_APP_KEYCLOAK_CLIENT' ) ,
124+ } ) ;
Original file line number Diff line number Diff line change 1- import { AppConfig } from 'config' ;
1+ import { getTenantDetail } from 'config' ;
22import Keycloak from 'keycloak-js' ;
3- import { ITenantDetail } from './types' ;
43
5- //TODO get from api
6- export const tenantDetail : ITenantDetail = {
7- realm : AppConfig . keycloak . realm ,
8- url : AppConfig . keycloak . url ,
9- clientId : AppConfig . keycloak . clientId ,
10- } ;
11-
12- export const _kc = new Keycloak ( tenantDetail ) ;
4+ export const _kc = new Keycloak ( getTenantDetail ( ) ) ;
You can’t perform that action at this time.
0 commit comments