From c85d83ae43bb3213ff729e586acff238bb617407 Mon Sep 17 00:00:00 2001 From: Frozen Raptor Date: Fri, 29 Jul 2022 16:02:14 +0000 Subject: [PATCH] Add env vars to load webui from different paths --- src/router.js | 1 + src/utils/socket.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/router.js b/src/router.js index 8418efb..9e3cc3f 100644 --- a/src/router.js +++ b/src/router.js @@ -120,6 +120,7 @@ const routes = [ const router = new VueRouter({ mode: 'history', + base: process.env.BASE_URL || '', routes, scrollBehavior() { return { x: 0, y: 0 } diff --git a/src/utils/socket.js b/src/utils/socket.js index 7f56ce6..363c087 100644 --- a/src/utils/socket.js +++ b/src/utils/socket.js @@ -33,5 +33,5 @@ class CustomSocket extends WebSocket { } } } - -export const socket = new CustomSocket((location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host + '/') +const domain = process.env.WEBSOCKET_URL || location.host +export const socket = new CustomSocket((location.protocol === 'https:' ? 'wss://' : 'ws://') + domain + '/')