Files
auto-stock/frontend/src/config.ts
2026-02-22 17:23:20 +09:00

17 lines
545 B
TypeScript

const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000'
// WebSocket URL: 현재 페이지 기준으로 자동 결정 (Docker/로컬 모두 호환)
const deriveWsUrl = () => {
const env = import.meta.env.VITE_WS_URL
if (env) return env
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
return `${proto}//${window.location.host}`
}
const WS_BASE_URL = deriveWsUrl()
export const config = {
apiBaseUrl: API_BASE_URL,
wsBaseUrl: WS_BASE_URL,
apiUrl: `${API_BASE_URL}/api/v1`,
}