From f5c9aa88072dc57cab376c093f341b3154d2e4db Mon Sep 17 00:00:00 2001 From: "jona.klaess" Date: Mon, 8 Jun 2026 15:22:18 +0200 Subject: [PATCH] use env vars --- quasar.config.js | 18 +++++++++--------- src/boot/axios.ts | 2 +- src/stores/user-store.ts | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/quasar.config.js b/quasar.config.js index ef30214..f497f4f 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -61,16 +61,16 @@ module.exports = configure(function (/* ctx */) { // publicPath: '/', // analyze: true, - env: { - //Defined in realm_export.json - KEYCLOAK_REALM:'PraxistransferKeycloak', - KEYCLOAK_CLIENT_ID:'praxistransfer', + // env: { + // //Defined in realm_export.json + // KEYCLOAK_REALM:'PraxistransferKeycloak', + // KEYCLOAK_CLIENT_ID:'praxistransfer', - //Defined in realm_export.json, initialize_keycloak.sh and quasar.config.js - PORT_KEYCLOAK:8083, - PORT_FRONTEND:frontendPort, - PORT_BACKEND:8081, - }, + // //Defined in realm_export.json, initialize_keycloak.sh and quasar.config.js + // PORT_KEYCLOAK:8083, + // PORT_FRONTEND:frontendPort, + // PORT_BACKEND:8081, + // }, // rawDefine: {} // ignorePublicFolder: true, // minify: false, diff --git a/src/boot/axios.ts b/src/boot/axios.ts index 5303aa9..b3a0460 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -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: 'http://localhost:'+ process.env.PORT_BACKEND }); +const api = axios.create({ baseURL: process.env.URL_BACKEND }); export default boot(({ app }) => { // for use inside Vue files (Options API) through this.$axios and this.$api diff --git a/src/stores/user-store.ts b/src/stores/user-store.ts index cf50b15..23ebc33 100644 --- a/src/stores/user-store.ts +++ b/src/stores/user-store.ts @@ -10,18 +10,18 @@ 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 keycloakPort: string = "" + process.env.PORT_KEYCLOAK; -const frontendPort: string = "" + process.env.PORT_FRONTEND; +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 keycloak: Keycloak = new Keycloak({ - url: 'http://localhost:' + keycloakPort + '/', + url: urlKeycloak, realm: realm, clientId: clientId }); const initOptions: KeycloakInitOptions = { onLoad: 'login-required', //erzwingt Login - redirectUri: 'http://localhost:' + frontendPort + '/', + redirectUri: urlFrontend + '/', checkLoginIframe: false, locale: 'login-required', } @@ -105,7 +105,7 @@ export const useUserStore = defineStore('userStore', { }, async logout() { - window.location.href= 'http://localhost:' + keycloakPort + '/realms/' + realm + '/protocol/openid-connect/logout?post_logout_redirect_uri=http%3A%2F%2Flocalhost:' + frontendPort + '&client_id=' + clientId; + window.location.href = urlKeycloak + '/realms/' + realm + '/protocol/openid-connect/logout?post_logout_redirect_uri=' + encodeURIComponent(urlFrontend + '/') + '&client_id=' + clientId; }, },