Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
docs: add note that .env is not read in production (#4714)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Apr 29, 2022
1 parent 68384b5 commit ff60e9f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/content/2.guide/2.features/10.runtime-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ console.log(runtimeConfig.public.apiBase)
### Environment Variables

The most common way to provide configuration is by using [Environment Variables](https://medium.com/chingu/an-introduction-to-environment-variables-and-how-to-use-them-f602f66d15fa).

::alert{type=info}
Nuxt CLI has built-in [dotenv](https://github.com/motdotla/dotenv) support.

In addition to any process environment variables, if you have a `.env` file in your project root directory, it will be automatically loaded into `process.env` and accessible within your `nuxt.config` file and modules.

However, **after your project is built**, you are responsible for setting environment variables when you run the server - your `.env` file will not be read at this point.
::

Runtime config values are automatically replaced by matching environment variables at runtime. For this to work, you _must_ have a fallback value (which can just be an empty string) defined in your `nuxt.config`.

**Example:**
Expand Down

0 comments on commit ff60e9f

Please sign in to comment.