use env vars

This commit is contained in:
jona.klaess
2026-06-08 15:22:18 +02:00
parent 4d7482c000
commit f5c9aa8807
3 changed files with 15 additions and 15 deletions

View File

@@ -61,16 +61,16 @@ module.exports = configure(function (/* ctx */) {
// publicPath: '/', // publicPath: '/',
// analyze: true, // analyze: true,
env: { // env: {
//Defined in realm_export.json // //Defined in realm_export.json
KEYCLOAK_REALM:'PraxistransferKeycloak', // KEYCLOAK_REALM:'PraxistransferKeycloak',
KEYCLOAK_CLIENT_ID:'praxistransfer', // KEYCLOAK_CLIENT_ID:'praxistransfer',
//Defined in realm_export.json, initialize_keycloak.sh and quasar.config.js // //Defined in realm_export.json, initialize_keycloak.sh and quasar.config.js
PORT_KEYCLOAK:8083, // PORT_KEYCLOAK:8083,
PORT_FRONTEND:frontendPort, // PORT_FRONTEND:frontendPort,
PORT_BACKEND:8081, // PORT_BACKEND:8081,
}, // },
// rawDefine: {} // rawDefine: {}
// ignorePublicFolder: true, // ignorePublicFolder: true,
// minify: false, // minify: false,

View File

@@ -14,7 +14,7 @@ declare module '@vue/runtime-core' {
// good idea to move this instance creation inside of the // good idea to move this instance creation inside of the
// "export default () => {}" function below (which runs individually // "export default () => {}" function below (which runs individually
// for each client) // 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 }) => { export default boot(({ app }) => {
// for use inside Vue files (Options API) through this.$axios and this.$api // for use inside Vue files (Options API) through this.$axios and this.$api

View File

@@ -10,18 +10,18 @@ import Keycloak, { KeycloakInitOptions, KeycloakLoginOptions } from 'keycloak-js
* @param realm Name des Realms, hinterlegt in realm-export.json von Keycloak * @param realm Name des Realms, hinterlegt in realm-export.json von Keycloak
* @param clientId Name des Clients, 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 urlKeycloak: string = "" + process.env.URL_KEYCLOAK;
const frontendPort: string = "" + process.env.PORT_FRONTEND; const urlFrontend: string = "" + process.env.URL_FRONTEND;
const realm : string= "" + process.env.KEYCLOAK_REALM; const realm : string= "" + process.env.KEYCLOAK_REALM;
const clientId: string = "" + process.env.KEYCLOAK_CLIENT_ID; const clientId: string = "" + process.env.KEYCLOAK_CLIENT_ID;
const keycloak: Keycloak = new Keycloak({ const keycloak: Keycloak = new Keycloak({
url: 'http://localhost:' + keycloakPort + '/', url: urlKeycloak,
realm: realm, realm: realm,
clientId: clientId clientId: clientId
}); });
const initOptions: KeycloakInitOptions = { const initOptions: KeycloakInitOptions = {
onLoad: 'login-required', //erzwingt Login onLoad: 'login-required', //erzwingt Login
redirectUri: 'http://localhost:' + frontendPort + '/', redirectUri: urlFrontend + '/',
checkLoginIframe: false, checkLoginIframe: false,
locale: 'login-required', locale: 'login-required',
} }
@@ -105,7 +105,7 @@ export const useUserStore = defineStore('userStore', {
}, },
async logout() { 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;
}, },
}, },