MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / loadConfig

Function loadConfig

src/lib/config.ts:35–46  ·  view source on GitHub ↗
(options: LoadConfigOptions = {})

Source from the content-addressed store, hash-verified

33 * the user's ~/.testsprite/credentials.
34 */
35export function loadConfig(options: LoadConfigOptions = {}): Config {
36 const env = options.env ?? process.env;
37 const profile = options.profile ?? env.TESTSPRITE_PROFILE ?? DEFAULT_PROFILE;
38 const credentialsPath = options.credentialsPath ?? defaultCredentialsPath();
39 const fileEntry = readProfile(profile, { path: credentialsPath });
40
41 return {
42 apiUrl: options.endpointUrl ?? env.TESTSPRITE_API_URL ?? fileEntry?.apiUrl ?? DEFAULT_API_URL,
43 apiKey: env.TESTSPRITE_API_KEY ?? fileEntry?.apiKey,
44 profile,
45 };
46}

Callers 5

resolveApiUrlFunction · 0.85
runWhoamiFunction · 0.85
runUsageFunction · 0.85
makeHttpClientFunction · 0.85
config.test.tsFile · 0.85

Calls 2

defaultCredentialsPathFunction · 0.85
readProfileFunction · 0.85

Tested by

no test coverage detected