(sourceEnv: Env)
| 27 | } |
| 28 | |
| 29 | function replaceProcessEnv(sourceEnv: Env) { |
| 30 | Object.keys(process.env).forEach((key) => { |
| 31 | // Allow mutating internal Next.js env variables after the server has initiated. |
| 32 | // This is necessary for dynamic things like the IPC server port. |
| 33 | if (!key.startsWith('__NEXT_PRIVATE')) { |
| 34 | if (sourceEnv[key] === undefined || sourceEnv[key] === '') { |
| 35 | delete process.env[key] |
| 36 | } |
| 37 | } |
| 38 | }) |
| 39 | |
| 40 | Object.entries(sourceEnv).forEach(([key, value]) => { |
| 41 | process.env[key] = value |
| 42 | }) |
| 43 | } |
| 44 | |
| 45 | export function processEnv( |
| 46 | loadedEnvFiles: LoadedEnvFiles, |
no test coverage detected