@keycloakify/keycloak-account-ui
Version:
<p align="center"> <img src="https://github.com/user-attachments/assets/e31c4910-7205-441c-9a35-e134b806b3a8"> </p> <p align="center"> <i>Repackaged Keycloak Account UI</i> <br> <br> <a href="https://github.com/keycloakify/keycloak-a
27 lines • 886 B
JavaScript
/**
* Extracts the environment variables from the document, these variables are injected by Keycloak as a script tag, the contents of which can be parsed as JSON. For example:
*
*```html
* <script id="environment" type="application/json">
* {
* "realm": "master",
* "clientId": "security-admin-console",
* "etc": "..."
* }
* </script>
* ```
*/
export function getInjectedEnvironment() {
const element = document.getElementById("environment");
const contents = element === null || element === void 0 ? void 0 : element.textContent;
if (typeof contents !== "string") {
throw new Error("Environment variables not found in the document.");
}
try {
return JSON.parse(contents);
}
catch (error) {
throw new Error("Unable to parse environment variables as JSON.");
}
}
//# sourceMappingURL=environment.js.map