(env = process.env)
| 18 | } |
| 19 | |
| 20 | export function getObservableApiOrigin(env = process.env): URL { |
| 21 | const urlText = env["OBSERVABLE_API_ORIGIN"]; |
| 22 | if (urlText) { |
| 23 | try { |
| 24 | return new URL(urlText); |
| 25 | } catch (error) { |
| 26 | throw new CliError(`Invalid OBSERVABLE_API_ORIGIN: ${urlText}`, {cause: error}); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | const uiOrigin = getObservableUiOrigin(env); |
| 31 | uiOrigin.hostname = "api." + uiOrigin.hostname; |
| 32 | return uiOrigin; |
| 33 | } |
| 34 | |
| 35 | export type ObservableApiClientOptions = { |
| 36 | apiOrigin?: URL; |
no test coverage detected