( configPath: string, runtimeFlags: RuntimeFlags )
| 304 | } |
| 305 | |
| 306 | function readFileStorageCredentials( |
| 307 | configPath: string, |
| 308 | runtimeFlags: RuntimeFlags |
| 309 | ): Credentials { |
| 310 | try { |
| 311 | const credentials = readCredentialsFromFile(configPath); |
| 312 | |
| 313 | if (cliConfig.authConfigHasUsableTokenData(credentials)) { |
| 314 | return credentials; |
| 315 | } |
| 316 | |
| 317 | return ( |
| 318 | tryReadKeyringCredentialsIntoFile(configPath, runtimeFlags) ?? credentials |
| 319 | ); |
| 320 | } catch (error) { |
| 321 | if (!isENOENTError(error)) { |
| 322 | throw error; |
| 323 | } |
| 324 | |
| 325 | const credentials = tryReadKeyringCredentialsIntoFile( |
| 326 | configPath, |
| 327 | runtimeFlags |
| 328 | ); |
| 329 | |
| 330 | if (credentials !== null) { |
| 331 | return credentials; |
| 332 | } |
| 333 | |
| 334 | throw error; |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | function migrateCredentialsToKeyring( |
| 339 | configPath: string, |
no test coverage detected