Unverified Commit 308a3279 authored by Juan Martín Seery's avatar Juan Martín Seery Committed by GitHub

feat(env): upgrade `dotenv` (#38481)

Upgraded dotenv to v16. Breaking changes are:

- Multiline parsing support
- Support inline comments
- Backtick support

[See their changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`
Co-authored-by: 's avatarBalázs Orbán <18369201+balazsorban44@users.noreply.github.com>
parent 24a14668
...@@ -48,7 +48,24 @@ export async function getStaticProps() { ...@@ -48,7 +48,24 @@ export async function getStaticProps() {
<AppOnly> <AppOnly>
This loads `process.env.DB_HOST`, `process.env.DB_USER`, and `process.env.DB_PASS` into the Node.js environment automatically allowing you to use them in [Route Handlers](/docs/app/building-your-application/routing/route-handlers). > **Note**: Next.js also supports multiline variables inside of your `.env*` files:
>
> ```bash
> # .env.local
>
> # you can write with line breaks
> PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
> ...
> Kh9NV...
> ...
> -----END DSA PRIVATE KEY-----"
>
> # or with `\n` inside double quotes
> PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nKh9NV...\n-----END DSA PRIVATE KEY-----\n"
> ```
> **Note**: If you are using a `/src` folder, please note that Next.js will load the .env files **only** from the parent folder and **not** from the `/src` folder.
> This loads `process.env.DB_HOST`, `process.env.DB_USER`, and `process.env.DB_PASS` into the Node.js environment automatically allowing you to use them in [Route Handlers](/docs/app/building-your-application/routing/route-handlers).
For example: For example:
...@@ -180,3 +197,9 @@ For example, if `NODE_ENV` is `development` and you define a variable in both `. ...@@ -180,3 +197,9 @@ For example, if `NODE_ENV` is `development` and you define a variable in both `.
- If you are using a [`/src` directory](/docs/app/building-your-application/configuring/src-directory), `.env.*` files should remain in the root of your project. - If you are using a [`/src` directory](/docs/app/building-your-application/configuring/src-directory), `.env.*` files should remain in the root of your project.
- If the environment variable `NODE_ENV` is unassigned, Next.js automatically assigns `development` when running the `next dev` command, or `production` for all other commands. - If the environment variable `NODE_ENV` is unassigned, Next.js automatically assigns `development` when running the `next dev` command, or `production` for all other commands.
## Version History
| Version | Changes |
| -------- | --------------------------------------------- |
| `v9.4.0` | Support `.env` and `NEXT_PUBLIC_` introduced. |
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
}, },
"devDependencies": { "devDependencies": {
"@vercel/ncc": "0.34.0", "@vercel/ncc": "0.34.0",
"dotenv": "10.0.0", "dotenv": "16.3.1",
"dotenv-expand": "8.0.1" "dotenv-expand": "10.0.0"
} }
} }
...@@ -1470,11 +1470,11 @@ importers: ...@@ -1470,11 +1470,11 @@ importers:
specifier: 0.34.0 specifier: 0.34.0
version: 0.34.0 version: 0.34.0
dotenv: dotenv:
specifier: 16.3.1
version: 16.3.1
dotenv-expand:
specifier: 10.0.0 specifier: 10.0.0
version: 10.0.0 version: 10.0.0
dotenv-expand:
specifier: 8.0.1
version: 8.0.1
packages/next-mdx: packages/next-mdx:
dependencies: dependencies:
...@@ -12457,14 +12457,20 @@ packages: ...@@ -12457,14 +12457,20 @@ packages:
is-obj: 2.0.0 is-obj: 2.0.0
dev: true dev: true
/dotenv-expand@8.0.1: /dotenv-expand@10.0.0:
resolution: {integrity: sha512-j/Ih7bIERDR5PzI89Zu8ayd3tXZ6E3dbY0ljQ9Db0K87qBO8zdLsi2dIvDHMWtjC3Yxb8XixOTHAtia0fDHRpg==} resolution: {integrity: sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==}
engines: {node: '>=12'} engines: {node: '>=12'}
dev: true dev: true
/dotenv@10.0.0: /dotenv@10.0.0:
resolution: {integrity: sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==} resolution: {integrity: sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==}
engines: {node: '>=10'} engines: {node: '>=10'}
dev: false
/dotenv@16.3.1:
resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==}
engines: {node: '>=12'}
dev: true
/downsample-lttb@0.0.1: /downsample-lttb@0.0.1:
resolution: {integrity: sha512-Olebo5gyh44OAXTd2BKdcbN5VaZOIKFzoeo9JUFwxDlGt6Sd8fUo6SKaLcafy8aP2UrsKmWDpsscsFEghMjeZA==} resolution: {integrity: sha512-Olebo5gyh44OAXTd2BKdcbN5VaZOIKFzoeo9JUFwxDlGt6Sd8fUo6SKaLcafy8aP2UrsKmWDpsscsFEghMjeZA==}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment