MCPcopy Create free account
hub / github.com/vercel/vercel / writeEnvFile

Function writeEnvFile

packages/container/src/dev.ts:74–86  ·  view source on GitHub ↗

* Write env vars to a temp Docker `--env-file` (KEY=VALUE per line). Values * containing newlines are skipped (the env-file format is line-based and can't * represent them). Returns the file path.

(env: Record<string, string>)

Source from the content-addressed store, hash-verified

72 * represent them). Returns the file path.
73 */
74function writeEnvFile(env: Record<string, string>): string {
75 const dir = mkdtempSync(path.join(tmpdir(), 'vercel-container-dev-env-'));
76 const file = path.join(dir, 'env');
77 const lines: string[] = [];
78 for (const [key, value] of Object.entries(env)) {
79 if (value.includes('\n')) {
80 continue;
81 }
82 lines.push(`${key}=${value}`);
83 }
84 writeFileSync(file, `${lines.join('\n')}\n`);
85 return file;
86}
87
88/**
89 * Sink for all dev output. `vercel dev` runs many services in parallel and

Callers 1

startContainerFunction · 0.85

Calls 2

pushMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected