myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests | README | LICENSE

commit 2ddf1c765f715c727b6ddc70b8ad613c8629f991
parent 6eafd956719bd1c68bba93d0ae68b48f31e27c48
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Fri, 27 Sep 2024 19:44:24 +0200

fix: add ws environment variable

Diffstat:
M.env | 8++++++--
Msrc/frontend/Leaderboard.jsx | 4+++-
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.env b/.env @@ -6,10 +6,14 @@ VITE_APP_DOC_TITLE='My Heats' # Cookie TTL in seconds (session ttl in the admin/judges frontend), 60m VITE_SESSION_TTL=3600 -# Full URI to backend API +# Full URI to backend http API VITE_API_URI=http://127.0.0.1 -# Backend API port +# Backend API http port VITE_API_PORT=8000 +# Full URI to backend websocket API +VITE_WS_URI=ws://127.0.0.1 +# Backend API websocket port +VITE_WS_PORT=8000 # Locale for frontend date formatting VITE_LOCALE=en-US diff --git a/src/frontend/Leaderboard.jsx b/src/frontend/Leaderboard.jsx @@ -5,9 +5,11 @@ import { addNewHeat } from './Heats' const api_uri = import.meta.env.VITE_API_URI const api_port = import.meta.env.VITE_API_PORT +const ws_uri = import.meta.env.VITE_WS_URI +const ws_port = import.meta.env.VITE_WS_PORT // use a socket for the real-time leaderboard data -let socket = new WebSocket(`ws://127.0.0.1:${api_port}/v1/leaderboard`); +let socket = new WebSocket(`${ws_uri}:${ws_port}/v1/leaderboard`); export async function addAthleteToHeat(athlete, heat) { const res = await fetch(`${api_uri}:${api_port}/v1/leaderboard/addAthleteToHeat`, {