Files
Zack TannerandGitHub 803bbe5c93 fix process.env not being available in standalone mode (#54203)
### What?
When running Next in standalone mode, `process.env` is not made
available to the render workers, making it impossible to access
environment variables that aren't provided in `.env` files.

### Why?
`initialEnv` is undefined in `createWorkers` when the server is started
in standalone mode.

### How?
This initializes the workers with `process.env` in case `initialEnv` is
unavailable, similar to the behavior of `loadEnvConfig()`

Closes NEXT-1508
Fixes #53367
2023-08-18 16:04:48 +02:00

9 lines
210 B
JavaScript

export default function handler(_, res) {
res.json({
env: process.env.FOO,
envLocal: process.env.LOCAL_SECRET,
envProd: process.env.PROD_SECRET,
envFromHost: process.env.ENV_FROM_HOST,
})
}