MCPcopy Create free account
hub / github.com/observablehq/framework / getObservableApiOrigin

Function getObservableApiOrigin

src/observableApiClient.ts:20–33  ·  view source on GitHub ↗
(env = process.env)

Source from the content-addressed store, hash-verified

18}
19
20export 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
35export type ObservableApiClientOptions = {
36 apiOrigin?: URL;

Callers 3

getOriginFunction · 0.85
constructorMethod · 0.85

Calls 1

getObservableUiOriginFunction · 0.85

Tested by

no test coverage detected