(value: string | undefined)
| 14 | } |
| 15 | |
| 16 | function shouldUseDevSameOriginProxy(value: string | undefined): boolean { |
| 17 | if (!import.meta.env.DEV || !value) return false |
| 18 | |
| 19 | try { |
| 20 | const url = new URL(value) |
| 21 | return (url.protocol === 'http:' || url.protocol === 'https:') |
| 22 | && isLoopbackHostname(url.hostname) |
| 23 | } catch { |
| 24 | return false |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | export function getApiBaseUrl(): string { |
| 29 | const configured = import.meta.env.VITE_API_URL |
no test coverage detected