MCPcopy Create free account
hub / github.com/ProtonDriveApps/sdk / getConfig

Function getConfig

cli/src/config.ts:52–78  ·  view source on GitHub ↗
(options: InitConfig)

Source from the content-addressed store, hash-verified

50 /** Whether to enable sending anonymized operational metrics. */
51 enableMetrics: boolean;
52 /** Level of logging to both console and log file. */
53 logLevel: LogLevel;
54
55 /** Where to persist the authenticated session. */
56 credentialsStore: CredentialsStoreType;
57 /** Only for testing: store cryptographic cache unencrypted. */
58 unsafeCache: boolean;
59}
60
61export function getConfig(options: InitConfig): Config {
62 const logLevelOption = process.env.PROTON_DRIVE_LOG_LEVEL?.toUpperCase() ?? 'DEBUG';
63 const logLevel = LogLevel[logLevelOption as keyof typeof LogLevel] ?? LogLevel.DEBUG;
64
65 const { cacheDir, appDir, logDir } = defaultDataDirs();
66
67 const baseUrl = process.env.PROTON_DRIVE_BASE_URL || 'drive-api.proton.me';
68
69 return {
70 clientUidPrefix: options.clientUidPrefix,
71 appVersion: options.appVersion,
72 authClientId: options.appVersion.startsWith('cli-drive') ? 'cli-drive' : 'external-drive',
73 sdkVersion: options.sdkVersion,
74 baseUrl,
75 accountUrl: accountUrlFromBaseUrl(baseUrl),
76 cacheDir,
77 appDir,
78 logDir,
79 enablePersistedEvents: options.enablePersistedEvents || false,
80 enableConsoleLog: options.enableConsoleLog || false,
81 enableMetrics: options.enableMetrics || false,

Callers 1

initFunction · 0.90

Calls 1

defaultDataDirsFunction · 0.85

Tested by

no test coverage detected