mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 09:55:53 +00:00
docs: add way to pass .env
variables to nuxt app in production (#5879)
This commit is contained in:
parent
b81c9c3a92
commit
433298f1e5
@ -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.
|
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 node .output/server/index.mjs`.
|
||||||
::
|
::
|
||||||
|
|
||||||
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`.
|
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`.
|
||||||
|
Loading…
Reference in New Issue
Block a user