From 7c428dbbe89e143e1a97cb4309655ec96a4e8a63 Mon Sep 17 00:00:00 2001 From: Benicio Cardozo Date: Wed, 13 Jul 2022 11:06:58 -0300 Subject: [PATCH 1/2] docs: add way to pass `.env` variables to nuxt app in production --- docs/content/2.guide/2.features/10.runtime-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/2.guide/2.features/10.runtime-config.md b/docs/content/2.guide/2.features/10.runtime-config.md index 527363b761b..f000ec757fe 100644 --- a/docs/content/2.guide/2.features/10.runtime-config.md +++ b/docs/content/2.guide/2.features/10.runtime-config.md @@ -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`. From 24643f28e9495d752501cb2ed05901f80a06caf6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 13 Jul 2022 16:54:06 +0100 Subject: [PATCH 2/2] Update docs/content/2.guide/2.features/10.runtime-config.md --- docs/content/2.guide/2.features/10.runtime-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/2.guide/2.features/10.runtime-config.md b/docs/content/2.guide/2.features/10.runtime-config.md index f000ec757fe..a81f5c89f0a 100644 --- a/docs/content/2.guide/2.features/10.runtime-config.md +++ b/docs/content/2.guide/2.features/10.runtime-config.md @@ -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. For example, you could pass the environment variables as arguments using the terminal `DATABASE_HOST=mydatabaseconnectionstring yarn start`. +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`.