Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: include test env in default env vars #13708

Merged
merged 6 commits into from
Jul 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/basic-features/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@ export default HomePage

## Default Environment Variables

In general only one `.env.local` file is needed. However, sometimes you might want to add some defaults for the `development` (`next dev`) or `production` (`next start`) environment.
In general only one `.env.local` file is needed. However, sometimes you might want to add some defaults for the `development` (`next dev`), `production` (`next start`) or `test` (depending on your test commands) environment.

Next.js allows you to set defaults in `.env` (all environments), `.env.development` (development environment), and `.env.production` (production environment).
Next.js allows you to set defaults in `.env` (all environments), `.env.development` (development environment), `.env.production` (production environment) and `.env.test` (testing environment).

`.env.local` always overrides the defaults set.
`.env.local` always overrides the defaults set, except for `test` environment since normally you expect tests to produce the same results for everyone.

> **Note**: `.env`, `.env.development`, and `.env.production` files should be included in your repository as they define defaults. **`.env*.local` should be added to `.gitignore`**, as those files are intended to be ignored. `.env.local` is where secrets can be stored.
> **Note**: `.env`, `.env.development`, `.env.production` and `.env.test` files should be included in your repository as they define defaults. **`.env*.local` should be added to `.gitignore`**, as those files are intended to be ignored. `.env.local` is where secrets can be stored.

## Environment Variables on Vercel

When deploying on [Vercel](https://vercel.com) you can configure secrets in the [Environment Variables](https://vercel.com/docs/v2/build-step#environment-variables) section of the project in the Vercel dashboard.

You can still use `.env`, `.env.development` and `.env.production` to add defaults.
You can still use `.env`, `.env.development`, `.env.production` and `.env.test` to add defaults.

If you've configured [Development Environment Variables](https://vercel.com/docs/v2/build-step#development-environment-variables) you can pull them into a `.env.local` for usage on your local machine using the following command:

Expand Down