use external env config
This commit is contained in:
@@ -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>
|
||||
|
||||
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
|
||||
// "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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user