MCPcopy Index your code
hub / github.com/devcontainers/cli / readSecretsFromFile

Function readSecretsFromFile

src/spec-node/devContainersSpecCLI.ts:1453–1479  ·  view source on GitHub ↗
(params: { output?: Log; secretsFile?: string; cliHost: CLIHost })

Source from the content-addressed store, hash-verified

1451}
1452
1453async 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
1481function warnDeprecatedLockfileFlags(experimentalLockfile: boolean, experimentalFrozenLockfile: boolean) {
1482 if (experimentalLockfile) {

Callers 2

provisionFunction · 0.85
doRunUserCommandsFunction · 0.85

Calls 2

readFileMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected