-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keycloak config into json config file [#41]
Depending on the environment the app loads the corresponding json config file. It is controlled by the webpack, see: 'config-overrides.js' Signed-off-by: Zoltan Magyari <[email protected]>
- Loading branch information
Zoltan Magyari
committed
Oct 8, 2024
1 parent
5e80d89
commit edf4e94
Showing
4 changed files
with
59 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
// Overrides create-react-app webpack configs without ejecting | ||
// https://github.com/timarney/react-app-rewired | ||
const path = require('path'); | ||
|
||
const { useBabelRc, override } = require('customize-cra'); | ||
module.exports = override(useBabelRc()); | ||
|
||
module.exports = override( | ||
// Use Babel config from .babelrc | ||
useBabelRc(), | ||
|
||
// Add Webpack alias for Keycloak configuration based on the environment | ||
(config) => { | ||
const isProduction = process.env.NODE_ENV === 'production'; | ||
|
||
// Define the path to the correct keycloak-config based on the environment | ||
config.resolve.alias['keycloak-config'] = path.resolve( | ||
__dirname, | ||
isProduction | ||
? 'src/keycloak-config.prod.json' // Production environment | ||
: 'src/keycloak-config.json' // Development environment | ||
); | ||
|
||
// Return the modified Webpack config | ||
return config; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"config": { | ||
"realm": "gaia-x", | ||
"clientId": "portal", | ||
"url": "https://fc-keycloak.gxfs.gx4fm.org/" | ||
}, | ||
"initOptions": { | ||
"onLoad": "check-sso", | ||
"checkLoginIframe": false, | ||
"pkceMethod": "S256" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"config": { | ||
"realm": "gaia-x", | ||
"clientId": "portal", | ||
"url": "https://fc-keycloak.gxfs.gx4fm.org/" | ||
}, | ||
"initOptions": { | ||
"onLoad": "check-sso", | ||
"checkLoginIframe": false, | ||
"pkceMethod": "S256" | ||
} | ||
} |