parent
101c202615
commit
e7dd75bc2b
@ -1,2 +1,2 @@
|
||||
VITE_EO_SERVICES_URL=http://localhost:3000
|
||||
VITE_API_BASE_URL=http://localhost:3000
|
||||
VITE_ROUTER_BASE=/
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
VITE_EO_SERVICES_URL=https://eo-services.mortons.site
|
||||
VITE_ROUTER_BASE=/eo-services
|
||||
VITE_API_BASE_URL=VITE_API_BASE_URL
|
||||
VITE_ROUTER_BASE=VITE_ROUTER_BASE
|
||||
|
||||
37
40-envsub-on-vite.sh
Normal file
37
40-envsub-on-vite.sh
Normal file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
# @see https://stackoverflow.com/questions/18185305/storing-bash-output-into-a-variable-using-eval
|
||||
set -e
|
||||
|
||||
ROOT_DIR=/app/eo-services
|
||||
ME=$(basename $0)
|
||||
|
||||
entrypoint_log() {
|
||||
if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
auto_envsubst() {
|
||||
|
||||
# Replace env vars in JavaScript files
|
||||
echo "Replacing env constants in JS"
|
||||
|
||||
keys="VITE_ROUTER_BASE
|
||||
VITE_API_BASE_URL"
|
||||
|
||||
for file in $ROOT_DIR/assets/index*.js* ;
|
||||
do
|
||||
echo "Processing $file ...";
|
||||
for key in $keys
|
||||
do
|
||||
value=$(eval echo \$$key)
|
||||
echo "replace $key by $value"
|
||||
sed -i 's#'"$key"'#'"$value"'#g' $file
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
auto_envsubst
|
||||
|
||||
exit 0
|
||||
|
||||
@ -13,5 +13,10 @@ COPY --from=build-stage /app/dist /app/eo-services
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY default.conf.template /etc/nginx/templates/default.conf.template
|
||||
COPY headers.js /etc/nginx/headers.js
|
||||
|
||||
COPY ./40-envsub-on-vite.sh /docker-entrypoint.d
|
||||
RUN chmod u+x /docker-entrypoint.d/40-envsub-on-vite.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@ -12,7 +12,7 @@ server {
|
||||
|
||||
location /mirror {
|
||||
internal;
|
||||
proxy_pass ${AUTH_PROXY_PASS};
|
||||
proxy_pass ${VITE_API_BASE_URL}/auth;
|
||||
proxy_set_header X-Original-URI $request_uri;
|
||||
}
|
||||
|
||||
|
||||
@ -10,11 +10,16 @@ services:
|
||||
image: registry.mortons.site/eo-services:latest
|
||||
ports:
|
||||
- "3000:3000"
|
||||
dns:
|
||||
- "8.8.8.8"
|
||||
|
||||
eo-services-client:
|
||||
environment:
|
||||
TZ: America/Chicago
|
||||
AUTH_PROXY_PASS: https://eo-services.mortons.site/api/auth
|
||||
VITE_API_BASE_URL: https://em28.verint.live/eo-services/api
|
||||
VITE_ROUTER_BASE: /eo-services/
|
||||
image: registry.mortons.site/eo-services-client:latest
|
||||
ports:
|
||||
- "18080:80"
|
||||
dns:
|
||||
- "8.8.8.8"
|
||||
7
src/app.config.js
Normal file
7
src/app.config.js
Normal 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,
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
|
||||
@ -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}`,
|
||||
{
|
||||
|
||||
@ -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}`,
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user