Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/common/api/Keycloak.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ let keycloak = null
let isInitialized = false
let initPromise = null

let keycloakRedirect = null
let hostname = window.location.hostname

if (hostname == 'ffiec.beta.cfpb.gov') {
keycloakRedirect = 'ffiec.cfpb.gov'
} else if (hostname.includes('4-beta')) {
keycloakRedirect = hostname.replace('4-beta.demo', 'dev')
} else if (hostname.includes('-beta')) {
keycloakRedirect = hostname.replace('-beta', '')
} else {
keycloakRedirect = hostname
}

const keycloakConfig = {
"realm": "hmda2",
"url": `https://${keycloakRedirect}/auth`,
"clientId": "hmda2-api",
"public-client": true,
"use-resource-role-mappings": true,
"confidential-port": 0,
"ssl-required": "all"
}

export const setKeycloak = (cloak) => {
keycloak = cloak
return keycloak
Expand All @@ -28,12 +51,12 @@ export const initKeycloak = (overrides) => {
} else if (import.meta.env.MODE === 'development') {
keycloak = new Keycloak('/local_keycloak.json')
} else {
keycloak = new Keycloak('/keycloak.json')
keycloak = new Keycloak(keycloakConfig)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be any easier to manage/revert the keycloak config as a ConfigMap?

}
}

initPromise = keycloak
.init({ pkceMethod: 'S256' })
.init({ pkceMethod: 'S256', checkLoginIframe: false })
.then((authenticated) => {
console.log('Keycloak initialized, authenticated:', authenticated)
isInitialized = true
Expand Down
28 changes: 9 additions & 19 deletions src/common/constants/prod-beta-config.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
{
"name": "prod-beta",
"announcement": [
{
"message": "Our beta platform is currently unavailable.",
"type": "error",
"heading": "System Temporarily Unavailable",
"link": null
}
],
"announcement": null,
"publicationReleaseYear": "2020",
"maintenanceMode": true,
"filingAnnouncement": {
"message": "Our beta platform is currently unavailable.",
"type": "error",
"heading": "System Temporarily Unavailable",
"endDate": null
},
"maintenanceMode": false,
"filingAnnouncement": null,
"ffvtAnnouncement": null,
"dataPublicationYears": {
"shared": [
Expand Down Expand Up @@ -80,10 +68,10 @@
"annual": "01/01/2025 - 03/03/2025 - 12/31/2027"
},
"2025": {
"Q1": "04/01/2025 - 05/30/2025 - 06/30/2025",
"Q1": "01/01/2025 - 06/30/2025 - 06/30/2025",
"Q2": "07/01/2025 - 08/29/2025 - 09/30/2025",
"Q3": "10/01/2025 - 12/01/2025 - 12/31/2025",
"annual": "01/01/2026 - 03/02/2026 - 12/31/2028"
"annual": "01/01/2025 - 03/02/2026 - 12/31/2028"
},
"2026": {
"Q1": "04/01/2026 - 06/01/2026 - 07/02/2026",
Expand Down Expand Up @@ -121,7 +109,9 @@
"2023-Q1",
"2023-Q2",
"2024",
"2024-Q1"
"2024-Q1",
"2025",
"2025-Q1"
]
}
}
}
10 changes: 5 additions & 5 deletions src/common/useEnvironmentConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { fetchEnvConfig, getDefaultConfig } from './configUtils'
export function useEnvironmentConfig(host) {
const [config, setConfig] = useState(getDefaultConfig(host))

useEffect(() => {
if (window.location.hostname !== 'localhost') {
fetchEnvConfig(setConfig, host).catch(() => null)
}
}, [host])
// useEffect(() => {
// if (window.location.hostname !== 'localhost') {
// fetchEnvConfig(setConfig, host).catch(() => null)
// }
// }, [host])

return config
}