Skip to content

Commit 7729f5c

Browse files
committed
add logic to decide the keycloak hostname
1 parent acfa862 commit 7729f5c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/common/api/Keycloak.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,22 @@ let keycloak = null
44
let isInitialized = false
55
let initPromise = null
66

7+
let keycloakRedirect = null
8+
let hostname = window.location.hostname
9+
10+
if (hostname == 'ffiec.beta.cfpb.gov') {
11+
keycloakRedirect = 'ffiec.cfpb.gov'
12+
} else if (hostname.includes('4-beta')) {
13+
keycloakRedirect = hostname.replace('4-beta.demo', 'dev')
14+
} else if (hostname.includes('-beta')) {
15+
keycloakRedirect = hostname.replace('-beta', '')
16+
} else {
17+
keycloakRedirect = hostname
18+
}
19+
720
const keycloakConfig = {
821
"realm": "hmda2",
9-
"url": "https://{{domain}}}/auth",
22+
"url": `https://${keycloakRedirect}/auth`,
1023
"clientId": "hmda2-api",
1124
"public-client": true,
1225
"use-resource-role-mappings": true,

0 commit comments

Comments
 (0)