( config: NextConfigComplete | NextConfigRuntime )
| 38 | * Collects the `env` config value from the Next.js config. |
| 39 | */ |
| 40 | export function getNextConfigEnv( |
| 41 | config: NextConfigComplete | NextConfigRuntime |
| 42 | ) { |
| 43 | // Refactored code below to use for-of |
| 44 | const defineEnv: Record<string, string | undefined> = {} |
| 45 | const env = config.env |
| 46 | for (const key in env) { |
| 47 | const value = env[key] |
| 48 | if (value != null) { |
| 49 | errorIfEnvConflicted(config, key) |
| 50 | defineEnv[`process.env.${key}`] = value |
| 51 | } |
| 52 | } |
| 53 | return defineEnv |
| 54 | } |
| 55 | |
| 56 | export function getStaticEnv( |
| 57 | config: NextConfigComplete | NextConfigRuntime, |
no test coverage detected