Skip to content

fix: make WebSocket URL configurable via env var for Docker deployments - #2

Draft
jonathan7gb with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-websocket-configuration
Draft

fix: make WebSocket URL configurable via env var for Docker deployments#2
jonathan7gb with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-websocket-configuration

Conversation

Copilot AI commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Hardcoded localhost:8080 in the SockJS factory means the frontend container can never reach the Java backend — localhost resolves to the frontend container itself, not the backend service.

Changes

  • src/hooks/usePainelWebSocket.ts — replace hardcoded URL with import.meta.env.VITE_WS_URL, falling back to localhost for local dev:

    webSocketFactory: () => new SockJS(import.meta.env.VITE_WS_URL || "http://localhost:8080/ws-time-trial"),

    Uses || (not ??) to also guard against an empty string env var.

  • .env.example (new) — documents VITE_WS_URL with a note that in Docker the value should match the backend's docker-compose service name, e.g. http://backend:8080/ws-time-trial.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…er support

Co-authored-by: jonathan7gb <159171775+jonathan7gb@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix websocket configuration for data printing fix: make WebSocket URL configurable via env var for Docker deployments Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants