Files
NowChess-Frontend/src/app/core/config.loader.ts
T
shosho996 95eff42dfe fix: NCWF-4 Token Issues (#8)
Co-authored-by: Lala, Shahd <Shahd.Lala@sybit.de>
Co-authored-by: shahdlala66 <shahd.lala66@gmail.com>
Reviewed-on: #8
2026-06-02 21:55:55 +02:00

14 lines
472 B
TypeScript

/**
* Load runtime configuration from window.__RUNTIME_CONFIG__
* This is injected by docker-entrypoint.sh at container startup
*/
export function loadRuntimeConfig() {
const config = (window as any).__RUNTIME_CONFIG__ || {};
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
const derivedWsUrl = `${wsProtocol}://${window.location.host}`;
return {
apiUrl: config.API_URL || '',
wsUrl: config.WEBSOCKET_URL || derivedWsUrl
};
}