| 496 | } |
| 497 | |
| 498 | private async collectAndUpdateEnvsAsync(envsDir: string): Promise<void> { |
| 499 | const filenames = await fs.readdir(envsDir); |
| 500 | |
| 501 | const entries = await Promise.all( |
| 502 | filenames.map(async basename => { |
| 503 | const rawContents = await fs.readFile(path.join(envsDir, basename), 'utf-8'); |
| 504 | const decodedContents = Buffer.from(rawContents, 'base64').toString('utf-8'); |
| 505 | return [basename, decodedContents]; |
| 506 | }) |
| 507 | ); |
| 508 | this.ctx.global.updateEnv({ |
| 509 | ...this.ctx.global.env, |
| 510 | ...Object.fromEntries(entries), |
| 511 | }); |
| 512 | } |
| 513 | |
| 514 | private getScriptEnv(): Record<string, string> { |
| 515 | const effectiveEnv = { ...this.ctx.global.env, ...this.stepEnvOverrides }; |