| 71 | }; |
| 72 | |
| 73 | function resolveApiBaseUrl() { |
| 74 | const metaEnv = (import.meta as RuntimeImportMeta).env; |
| 75 | if (metaEnv?.VITE_API_URL && metaEnv.VITE_API_URL.trim().length > 0) { |
| 76 | return metaEnv.VITE_API_URL; |
| 77 | } |
| 78 | |
| 79 | if (typeof process !== 'undefined') { |
| 80 | const nodeEnv = (process.env ?? {}).VITE_API_URL; |
| 81 | if (nodeEnv && nodeEnv.trim().length > 0) { |
| 82 | return nodeEnv; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | return 'http://localhost:3211'; |
| 87 | } |
| 88 | |
| 89 | export const API_BASE_URL = resolveApiBaseUrl(); |
| 90 | export const API_V1_URL = `${API_BASE_URL}/api/v1`; |