From 0ebe809641450009dc299d0e2878446bb9de69b3 Mon Sep 17 00:00:00 2001 From: Nadim Ritter Date: Mon, 26 Aug 2024 16:02:29 +0200 Subject: [PATCH] hardcode base path --- client/vite.config.mts | 2 +- server/src/app.ts | 2 +- server/src/config/envConfig.ts | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/client/vite.config.mts b/client/vite.config.mts index 8e1696c..319b8f1 100644 --- a/client/vite.config.mts +++ b/client/vite.config.mts @@ -37,7 +37,7 @@ export default defineConfig({ // gitTagPlugin() ], - base: "/sps-gui", + base: process.env.VITE_BASE_PATH, build: { chunkSizeWarningLimit: 2000 diff --git a/server/src/app.ts b/server/src/app.ts index ff866cc..dcc3de5 100644 --- a/server/src/app.ts +++ b/server/src/app.ts @@ -41,7 +41,7 @@ app.use(routes); //static files routes -app.get("/", (req: Request, res: Response) => { +app.get(ENV.BASE_PATH + "/", (req: Request, res: Response) => { res.sendFile(mainIndexPath); }); diff --git a/server/src/config/envConfig.ts b/server/src/config/envConfig.ts index b394e6e..84315fa 100644 --- a/server/src/config/envConfig.ts +++ b/server/src/config/envConfig.ts @@ -13,11 +13,18 @@ export const PROCTOR_SERVER_PASSWORD = process.env.PROCTOR_SERVER_PASSWORD; export const SEB_SERVER_INTEGRATED_MODE = process.env.SEB_SERVER_INTEGRATED_MODE; -export const BASE_PATH = process.env.VITE_BASE_PATH; +export const BASE_PATH = getBasePath(); function getServerPort(){ if(!process.env.PROCTOR_SERVER_PORT){ return ""; } return ":" + process.env.PROCTOR_SERVER_PORT; +}; + +function getBasePath(){ + if(!process.env.VITE_BASE_PATH){ + return ""; + } + return process.env.VITE_BASE_PATH; }; \ No newline at end of file