From 9f9abb45ec06cb4702dca5dc7764c09275e85997 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Mon, 16 Feb 2026 00:29:19 -0500 Subject: [PATCH] fix: Update WebSocket and API URLs to use environment variables for better configuration --- client/src/store/turtleStore.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/store/turtleStore.js b/client/src/store/turtleStore.js index e7a4841..26b68b1 100644 --- a/client/src/store/turtleStore.js +++ b/client/src/store/turtleStore.js @@ -1,7 +1,11 @@ import { create } from 'zustand'; -const WS_URL = 'ws://localhost:3002'; -const API_URL = 'http://localhost:3001'; +// Use environment variables or fallback to relative URLs for proxy +const WS_URL = import.meta.env.VITE_WS_URL || `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}/ws`; +const API_URL = import.meta.env.VITE_API_URL || `${window.location.protocol}//${window.location.host}/api`; + +console.log('🔌 WebSocket URL:', WS_URL); +console.log('📡 API URL:', API_URL); export const useTurtleStore = create((set, get) => ({ // State