🎥 Make videos programmatically with React
Update env variable docs
Jonny Burger942bfd0c4a15
diff --git a/packages/docs/docs/contributing/docs.md b/packages/docs/docs/contributing/docs.mdindex a2732236b4..cff4ae29dd 100644--- a/packages/docs/docs/contributing/docs.md+++ b/packages/docs/docs/contributing/docs.md@@ -31,6 +31,7 @@ Each page has a button `Improve this page` at the bottom. This is the easiest wa- **Separate into multiple paragraphs** if a section is becoming too long.- **Address the reader as "you"** and not "we".- **Don't blame the user**: Instead of "You have provided the wrong input", say "The input is invalid" or "the wrong input was provided".+- **Don't assume it is easy**: Avoid using the words "simply" and "just" as beginners might not find it as simple as you do.## Adding code snippetsdiff --git a/packages/docs/docs/env-variables.md b/packages/docs/docs/env-variables.mdindex 8e487cddb8..0efa770c5e 100644--- a/packages/docs/docs/env-variables.md+++ b/packages/docs/docs/env-variables.md@@ -11,7 +11,7 @@ Remotion supports environment variables being passed directly from the CLI, usin## Passing variables from the CLI-If you want to pass an environment variable from the CLI, you need to prefix it with `REMOTION_`. This is a security feature to prevent your whole environment which could contain sensitive information being included in a Webpack bundle.+If you want to pass an environment variable from the CLI, you need to prefix it with `REMOTION_`. This is a security feature to prevent your whole environment (which could contain sensitive information) being included in a Webpack bundle.You can pass environment variables in development mode and while rendering. For example:@@ -23,22 +23,28 @@ In your project, you can access the variable using `process.env.REMOTION_MY_VAR`## Using a dotenv file-[Dotenv](https://www.npmjs.com/package/dotenv) support is built in. Simply place a `.env` file in the root of your project and place key-value pairs in it.+[Dotenv](https://www.npmjs.com/package/dotenv) support is built in if you use the CLI.-For example, if your file contains+Place a `.env` file in the [root](/docs/terminology#remotion-root) of your project and fill it with key-value pairs.```ini title=".env"MY_VAR=helloANOTHER_VAR=world```-in your project you can read `process.env` to get an object `{"MY_VAR": "hello", "ANOTHER_VAR": "world"}`.+In your Remotion project you can read `process.env` to get an object of environment variables: `{"MY_VAR": "hello", "ANOTHER_VAR": "world"}`.You can override the location of your dotenv file using the [configuration file setting](/docs/config#setdotenvlocation) or the [CLI flag](/docs/cli).-## Setting via `renderMedia()`+## Using in Node.js APIs-The above two methods only work when rendering from the CLI. To pass environment variables while server-side-rendering, pass an object to the [`envVariables` option of `renderMedia()`](/docs/renderer/render-media#envvariables).+When using the [Node.js APIs](/docs/renderer) such as [`renderMedia()`](/docs/renderer/render-media) or [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda), the environment variables are **not** picked up automatically.++The reason is that one might integrate Remotion as a small part of a big application and if Remotion would read the `.env` file and pick up all secrets and forwards it to renders, it would lead to a security issue.++To pass environment variables while server-side-rendering, pass an object to the [`envVariables` option of `renderMedia()`](/docs/renderer/render-media#envvariables).++If you want to read the environment variables from a `.env` file, use the [dotenv](https://www.npmjs.com/package/dotenv) package.## See also