Skip to content

Commit b517fc2

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

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/common/api/Keycloak.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,27 @@ let keycloak = null
44
let isInitialized = false
55
let initPromise = null
66

7+
let keycloakRedirect = null
8+
let hostname = window.location.hostname
9+
10+
console.log(hostname)
11+
12+
if (hostname == 'ffiec.beta.cfpb.gov') {
13+
keycloakRedirect = 'ffiec.cfpbb.gov'
14+
} else if (hostname == 'hmda4-beta.demo.cfpb.gov') {
15+
keycloakRedirect = 'hmdadev.cfpb.gov'
16+
} else if (hostname == 'localhost') {
17+
keycloakRedirect = 'ffiec.cfpb.gov'
18+
} else if (hostname.includes('-beta')) {
19+
keycloakRedirect = hostname.replace('-beta', '')
20+
console.log(keycloakRedirect)
21+
} else {
22+
keycloakRedirect = hostname
23+
}
24+
725
const keycloakConfig = {
826
"realm": "hmda2",
9-
"url": "https://{{domain}}}/auth",
27+
"url": `https://${keycloakRedirect}/auth`,
1028
"clientId": "hmda2-api",
1129
"public-client": true,
1230
"use-resource-role-mappings": true,

0 commit comments

Comments
 (0)