use external env config
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
<script src="/env-config.js"></script>
|
||||||
<!-- quasar:entry-point -->
|
<!-- quasar:entry-point -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
7
public/env-config.template.js
Normal file
7
public/env-config.template.js
Normal 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}"
|
||||||
|
};
|
||||||
@@ -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: process.env.URL_BACKEND });
|
const api = axios.create({ baseURL: window.__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
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ 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 urlKeycloak: string = "" + process.env.URL_KEYCLOAK;
|
const urlKeycloak: string = "" + window.__ENV__?.URL_KEYCLOAK;
|
||||||
const urlFrontend: string = "" + process.env.URL_FRONTEND;
|
const urlFrontend: string = "" + window.__ENV__?.URL_FRONTEND;
|
||||||
const realm : string= "" + process.env.KEYCLOAK_REALM;
|
const realm : string= "" + window.__ENV__?.KEYCLOAK_REALM;
|
||||||
const clientId: string = "" + process.env.KEYCLOAK_CLIENT_ID;
|
const clientId: string = "" + window.__ENV__?.KEYCLOAK_CLIENT_ID;
|
||||||
const keycloak: Keycloak = new Keycloak({
|
const keycloak: Keycloak = new Keycloak({
|
||||||
url: urlKeycloak,
|
url: urlKeycloak,
|
||||||
realm: realm,
|
realm: realm,
|
||||||
|
|||||||
Reference in New Issue
Block a user