(params: { output?: Log; secretsFile?: string; cliHost: CLIHost })
| 1451 | } |
| 1452 | |
| 1453 | async function readSecretsFromFile(params: { output?: Log; secretsFile?: string; cliHost: CLIHost }) { |
| 1454 | const { secretsFile, cliHost, output } = params; |
| 1455 | if (!secretsFile) { |
| 1456 | return {}; |
| 1457 | } |
| 1458 | |
| 1459 | try { |
| 1460 | const fileBuff = await cliHost.readFile(secretsFile); |
| 1461 | const parseErrors: jsonc.ParseError[] = []; |
| 1462 | const secrets = jsonc.parse(fileBuff.toString(), parseErrors) as Record<string, string>; |
| 1463 | if (parseErrors.length) { |
| 1464 | throw new Error('Invalid json data'); |
| 1465 | } |
| 1466 | |
| 1467 | return secrets; |
| 1468 | } |
| 1469 | catch (e) { |
| 1470 | if (output) { |
| 1471 | output.write(`Failed to read/parse secrets from file '${secretsFile}'`, LogLevel.Error); |
| 1472 | } |
| 1473 | |
| 1474 | throw new ContainerError({ |
| 1475 | description: 'Failed to read/parse secrets', |
| 1476 | originalError: e |
| 1477 | }); |
| 1478 | } |
| 1479 | } |
| 1480 | |
| 1481 | function warnDeprecatedLockfileFlags(experimentalLockfile: boolean, experimentalFrozenLockfile: boolean) { |
| 1482 | if (experimentalLockfile) { |
no test coverage detected