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

@@ -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

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 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;
},
},