feat: Update routing and websocket configuration for game state management

This commit is contained in:
2025-12-11 10:24:51 +01:00
parent 4463144d1b
commit 76258b3ca8
22 changed files with 173 additions and 151 deletions

View File

@@ -2,13 +2,18 @@
// Reads runtime configuration injected into window.__RUNTIME_CONFIG__ (created by env.js at container start)
declare global {
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string } }
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string; WEBSOCKET_URL?: string } }
}
const runtime = (globalThis as any).__RUNTIME_CONFIG__ || {};
export const API_URL = runtime.API_URL || (import.meta.env.VITE_API_URL as string) || 'http://localhost:9000';
export const WEBSOCKET_URL = runtime.API_URL || (import.meta.env.VITE_WEBSOCKET_URL as string) || 'http://localhost:9000';
export function getApiUrl(): string {
return API_URL;
}
export function getWebsocketUrl(): string {
return WEBSOCKET_URL;
}