Enable container environment variables for config.

Fixes #1
This commit is contained in:
2023-10-18 17:51:49 -05:00
parent 101c202615
commit e7dd75bc2b
11 changed files with 70 additions and 13 deletions

7
src/app.config.js Normal file
View File

@@ -0,0 +1,7 @@
export const apiBaseUrl = import.meta.env.VITE_API_BASE_URL
export const routerBase = import.meta.env.VITE_ROUTER_BASE
export default {
apiBaseUrl,
routerBase,
}

View File

@@ -1,3 +1,5 @@
import { apiBaseUrl } from '../app.config.js';
export function getAuthKeyFromProperties(props) {
var authKey;
@@ -27,9 +29,7 @@ export function getTenantProperty(key, props) {
var authKey = getAuthKeyFromProperties(props);
console.log(`Fetching TPS Property [${key}]`);
fetch(
`${
import.meta.env.VITE_EO_SERVICES_URL
}/api/tps?propertyName=${key}&authKey=${authKey}`,
`${apiBaseUrl}/tps?propertyName=${key}&authKey=${authKey}`,
{
credentials: "include", // fetch won't send cookies unless you set credentials
}

View File

@@ -1,4 +1,5 @@
import { createRouter, createWebHistory } from "vue-router";
import { routerBase } from '../app.config.js';
import HomeView from "../views/HomeView.vue";
import AboutView from "../views/AboutView.vue";
import DebugFrameView from "../views/DebugFrameView.vue";
@@ -62,9 +63,11 @@ const routes = [
},
];
console.log(`mounting router on ${routerBase}`)
const router = createRouter({
history: createWebHistory(),
base: `${import.meta.env.VITE_ROUTER_BASE}`,
base: routerBase,
routes,
});

View File

@@ -1,4 +1,5 @@
<script setup>
import { apiBaseUrl } from '../app.config.js';
import { ref, onMounted } from "vue";
import { getAuthKeyFromProperties } from "../helpers/index";
@@ -43,7 +44,7 @@ function fetchData() {
return;
}
fetch(
`${import.meta.env.VITE_EO_SERVICES_URL}/api/interactions-flow?filter=${
`${apiBaseUrl}/interactions-flow?filter=${
multiSelected.value
}&authKey=${authKey}`,
{

View File

@@ -1,4 +1,5 @@
<script setup>
import { apiBaseUrl } from '../app.config.js';
import { ref } from "vue";
import { getAuthKeyFromProperties } from "../helpers/index";
@@ -28,9 +29,7 @@ function fetchData() {
if (authKey) {
fetch(
`${
import.meta.env.VITE_EO_SERVICES_URL
}/api/unified-data-gateway?referenceId=${
`${apiBaseUrl}/unified-data-gateway?referenceId=${
referenceId.value
}&authKey=${authKey}`,
{