use external env config

This commit is contained in:
jona.klaess
2026-06-08 15:35:26 +02:00
parent f5c9aa8807
commit 86df46cdcf
4 changed files with 13 additions and 5 deletions

View File

@@ -17,6 +17,7 @@
</head>
<body>
<script type="module" src="/src/main.ts"></script>
<script src="/env-config.js"></script>
<!-- quasar:entry-point -->
</body>
</html>

View File

@@ -0,0 +1,7 @@
window.__ENV__ = {
URL_KEYCLOAK: "${URL_KEYCLOAK}",
KEYCLOAK_REALM: "${KEYCLOAK_REALM}",
KEYCLOAK_CLIENT_ID: "${KEYCLOAK_CLIENT_ID}",
URL_FRONTEND: "${URL_FRONTEND}",
URL_BACKEND: "${URL_BACKEND}"
};

View File

@@ -14,7 +14,7 @@ declare module '@vue/runtime-core' {
// good idea to move this instance creation inside of the
// "export default () => {}" function below (which runs individually
// for each client)
const api = axios.create({ baseURL: process.env.URL_BACKEND });
const api = axios.create({ baseURL: window.__ENV__?.URL_BACKEND });
export default boot(({ app }) => {
// for use inside Vue files (Options API) through this.$axios and this.$api

View File

@@ -10,10 +10,10 @@ import Keycloak, { KeycloakInitOptions, KeycloakLoginOptions } from 'keycloak-js
* @param realm Name des Realms, hinterlegt in realm-export.json von Keycloak
* @param clientId Name des Clients, hinterlegt in realm-export.json von Keycloak
*/
const urlKeycloak: string = "" + process.env.URL_KEYCLOAK;
const urlFrontend: string = "" + process.env.URL_FRONTEND;
const realm : string= "" + process.env.KEYCLOAK_REALM;
const clientId: string = "" + process.env.KEYCLOAK_CLIENT_ID;
const urlKeycloak: string = "" + window.__ENV__?.URL_KEYCLOAK;
const urlFrontend: string = "" + window.__ENV__?.URL_FRONTEND;
const realm : string= "" + window.__ENV__?.KEYCLOAK_REALM;
const clientId: string = "" + window.__ENV__?.KEYCLOAK_CLIENT_ID;
const keycloak: Keycloak = new Keycloak({
url: urlKeycloak,
realm: realm,