Skip to content

Commit

Permalink
Removes PORT from .env concatenation example (#51063)
Browse files Browse the repository at this point in the history
This is to [avoid confusion](#32603 (comment)) about being able to set Next.js's port via `.env`, which is currently not allowed.
  • Loading branch information
manovotny committed Jun 10, 2023
1 parent 9bc73db commit 8386009
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@ This loads `process.env.DB_HOST`, `process.env.DB_USER`, and `process.env.DB_PAS
Next.js will automatically expand variables that use `$` to reference other variables e.g. `$VARIABLE` inside of your `.env*` files. This allows you to reference other secrets. For example:

```txt filename=".env"
HOSTNAME=localhost
PORT=8080
HOST=http://$HOSTNAME:$PORT
TWITTER_USER=vercel
TWITTER_URL=https://twitter.com/$TWITTER_USER
```

In the above example, `process.env.HOST` would be set to `http://localhost:8080`.
In the above example, `process.env.TWITTER_URL` would be set to `http://twitter.com/vercel`.

> **Note**: If you need to use variable with a `$` in the actual value, it needs to be escaped e.g. `\$`.
Expand Down

0 comments on commit 8386009

Please sign in to comment.