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

docs: add way to pass .env variables to nuxt app in production #5879

Merged
merged 2 commits into from
Jul 14, 2022
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
2 changes: 1 addition & 1 deletion docs/content/2.guide/2.features/10.runtime-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ 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.
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. For example, you could pass the environment variables as arguments using the terminal `DATABASE_HOST=mydatabaseconnectionstring yarn start`.
::

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`.
Expand Down