()
| 40 | * Falls back to NEXT_PUBLIC_APP_URL when INTERNAL_API_BASE_URL is not set. |
| 41 | */ |
| 42 | export function getInternalApiBaseUrl(): string { |
| 43 | const internalBaseUrl = getEnv('INTERNAL_API_BASE_URL')?.trim() |
| 44 | if (!internalBaseUrl) { |
| 45 | return getBaseUrl() |
| 46 | } |
| 47 | |
| 48 | if (!hasHttpProtocol(internalBaseUrl)) { |
| 49 | throw new Error( |
| 50 | 'INTERNAL_API_BASE_URL must include protocol (http:// or https://), e.g. http://sim-app.default.svc.cluster.local:3000' |
| 51 | ) |
| 52 | } |
| 53 | |
| 54 | return internalBaseUrl |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Ensures a URL is absolute by prefixing the base URL when a relative path is provided. |
no test coverage detected