MCPcopy
hub / github.com/lingodotdev/lingo.dev / getSettings

Function getSettings

packages/cli/src/cli/utils/settings.ts:10–48  ·  view source on GitHub ↗
(explicitApiKey: string | undefined)

Source from the content-addressed store, hash-verified

8export type CliSettings = Z.infer<typeof SettingsSchema>;
9
10export function getSettings(explicitApiKey: string | undefined): CliSettings {
11 const env = _loadEnv();
12 const systemFile = _loadSystemFile();
13 const defaults = _loadDefaults();
14
15 _legacyEnvVarWarning();
16
17 _envVarsInfo();
18
19 return {
20 auth: {
21 apiKey:
22 explicitApiKey ||
23 env.LINGO_API_KEY ||
24 env.LINGODOTDEV_API_KEY ||
25 systemFile.auth?.apiKey ||
26 systemFile.auth?.vnext?.apiKey ||
27 defaults.auth.apiKey,
28 apiUrl:
29 env.LINGO_API_URL ||
30 env.LINGODOTDEV_API_URL ||
31 systemFile.auth?.apiUrl ||
32 defaults.auth.apiUrl,
33 webUrl:
34 env.LINGODOTDEV_WEB_URL ||
35 systemFile.auth?.webUrl ||
36 defaults.auth.webUrl,
37 },
38 llm: {
39 openaiApiKey: env.OPENAI_API_KEY || systemFile.llm?.openaiApiKey,
40 anthropicApiKey: env.ANTHROPIC_API_KEY || systemFile.llm?.anthropicApiKey,
41 groqApiKey: env.GROQ_API_KEY || systemFile.llm?.groqApiKey,
42 googleApiKey: env.GOOGLE_API_KEY || systemFile.llm?.googleApiKey,
43 openrouterApiKey:
44 env.OPENROUTER_API_KEY || systemFile.llm?.openrouterApiKey,
45 mistralApiKey: env.MISTRAL_API_KEY || systemFile.llm?.mistralApiKey,
46 },
47 };
48}
49
50export function saveSettings(settings: CliSettings): void {
51 _saveSystemFile(settings);

Callers 9

status.tsFile · 0.90
login.tsFile · 0.90
openUrlFunction · 0.90
init.tsFile · 0.90
auth.tsFile · 0.90
i18n.tsFile · 0.90
logout.tsFile · 0.90
index.tsFile · 0.90

Calls 5

_loadEnvFunction · 0.85
_loadSystemFileFunction · 0.85
_loadDefaultsFunction · 0.85
_legacyEnvVarWarningFunction · 0.85
_envVarsInfoFunction · 0.85

Tested by

no test coverage detected