MCPcopy Create free account
hub / github.com/tiann/hapi / initializeApiUrl

Function initializeApiUrl

cli/src/ui/apiUrlInit.ts:17–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 * Must be called before any API operations
16 */
17export async function initializeApiUrl(): Promise<void> {
18 // 1. Environment variable has highest priority (allows temporary override)
19 if (process.env.HAPI_API_URL) {
20 return
21 }
22
23 // 2. Read from settings file (new name first, then legacy)
24 const settings = await readSettings()
25 if (settings.apiUrl) {
26 configuration._setApiUrl(settings.apiUrl)
27 return
28 }
29 if (settings.serverUrl) {
30 // Migrate from legacy field name
31 configuration._setApiUrl(settings.serverUrl)
32 return
33 }
34
35 // 3. Default value already set in configuration constructor
36}

Callers 2

handleAuthCommandFunction · 0.90
initializeTokenFunction · 0.90

Calls 2

readSettingsFunction · 0.90
_setApiUrlMethod · 0.80

Tested by

no test coverage detected