MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveCloudBaseUrl

Function resolveCloudBaseUrl

src/cli/auth-session.ts:512–524  ·  view source on GitHub ↗
(env: EnvMap, fallback?: string)

Source from the content-addressed store, hash-verified

510}
511
512function resolveCloudBaseUrl(env: EnvMap, fallback?: string): string {
513 const raw = env.AGENT_DEVICE_CLOUD_BASE_URL ?? fallback ?? DEFAULT_CLOUD_BASE_URL;
514 try {
515 return new URL(raw).toString().replace(/\/+$/, '');
516 } catch (error) {
517 throw new AppError(
518 'INVALID_ARGS',
519 'Invalid AGENT_DEVICE_CLOUD_BASE_URL.',
520 { cloudBaseUrl: raw },
521 error instanceof Error ? error : undefined,
522 );
523 }
524}
525
526function shouldUseCloudAuth(daemonBaseUrl: string, env: EnvMap): boolean {
527 if (env.AGENT_DEVICE_CLOUD_AUTH === '1' || env.AGENT_DEVICE_CLOUD_AUTH === 'true') return true;

Callers 5

loginWithDeviceAuthFunction · 0.85
resolveCliSessionAccessFunction · 0.85
refreshAgentTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected