You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You need to keep `.env` files in sync between machines, environments, or team members? Use [dotenv-vault](https://github.com/dotenv-org/dotenv-vault).
201
+
You need to keep `.env` files in sync between machines, environments, or team members? Use [dotenvx](https://github.com/dotenvx/dotenvx) to encrypt your `.env` files and safely include them in source control. This still subscribes to the twelve-factor app rules by generating a decryption key separate from code.
182
202
183
203
### Multiple Environments
184
204
185
-
You need to manage your secrets across different environments and apply them as needed? Use a `.env.vault` file with a `DOTENV_KEY`.
205
+
Use [dotenvx](https://github.com/dotenvx/dotenvx) to generate `.env.ci`, `.env.production` files, and more.
186
206
187
207
### Deploying
188
208
189
-
You need to deploy your secrets in a cloud-agnostic manner? Use a `.env.vault` file. See [deploying `.env.vault` files](https://github.com/motdotla/dotenv/tree/master#-deploying).
209
+
You need to deploy your secrets in a cloud-agnostic manner? Use [dotenvx](https://github.com/dotenvx/dotenvx) to generate a private decryption key that is set on your production server.
190
210
191
211
## 🌴 Manage Multiple Environments
192
212
193
-
Use [dotenvx](https://github.com/dotenvx/dotenvx) or [dotenv-vault](https://github.com/dotenv-org/dotenv-vault).
194
-
195
-
### dotenvx
213
+
Use [dotenvx](https://github.com/dotenvx/dotenvx)
196
214
197
215
Run any environment locally. Create a `.env.ENVIRONMENT` file and use `--env-file` to load it. It's straightforward, yet flexible.
*ℹ️ 🔐 Vault Managed vs 💻 Locally Managed: The above example, for brevity's sake, used the 🔐 Vault Managed solution to manage your `.env.vault` file. You can instead use the 💻 Locally Managed solution. [Read more here](https://github.com/dotenv-org/dotenv-vault#how-do-i-use--locally-managed-dotenv-vault). Our vision is that other platforms and orchestration tools adopt the `.env.vault` standard as they did the `.env` standard. We don't expect to be the only ones providing tooling to manage and generate `.env.vault` files.*
236
-
237
-
<ahref="https://github.com/dotenv-org/dotenv-vault#-manage-multiple-environments">Learn more at dotenv-vault: Manage Multiple Environments</a>
238
-
239
239
## 🚀 Deploying
240
240
241
-
Use [dotenvx](https://github.com/dotenvx/dotenvx) or [dotenv-vault](https://github.com/dotenv-org/dotenv-vault).
241
+
Use [dotenvx](https://github.com/dotenvx/dotenvx).
242
242
243
-
### dotenvx
243
+
Add encryption to your `.env` files with a single command. Pass the `--encrypt` flag.
244
244
245
-
Encrypt your secrets to a `.env.vault` file and load from it (recommended for production and ci).
246
-
247
-
```bash
248
-
$ echo"HELLO=World"> .env
249
-
$ echo"HELLO=production"> .env.production
245
+
```
246
+
$ dotenvx set HELLO Production --encrypt -f .env.production
That's it! On deploy, your `.env.vault` file will be decrypted and its secrets injected as environment variables – just in time.
288
-
289
-
*ℹ️ A note from [Mot](https://github.com/motdotla): Until recently, we did not have an opinion on how and where to store your secrets in production. We now strongly recommend generating a `.env.vault` file. It's the best way to prevent your secrets from being scattered across multiple servers and cloud providers – protecting you from breaches like the [CircleCI breach](https://techcrunch.com/2023/01/05/circleci-breach/). Also it unlocks interoperability WITHOUT native third-party integrations. Third-party integrations are [increasingly risky](https://coderpad.io/blog/development/heroku-github-breach/) to our industry. They may be the 'du jour' of today, but we imagine a better future.*
290
-
291
-
<ahref="https://github.com/dotenv-org/dotenv-vault#-deploying">Learn more at dotenv-vault: Deploying</a>
292
-
293
256
## 📚 Examples
294
257
295
258
See [examples](https://github.com/dotenv-org/examples) of using dotenv with various frameworks, languages, and configurations.
@@ -298,7 +261,6 @@ See [examples](https://github.com/dotenv-org/examples) of using dotenv with vari
console.log(myObject) // values from .env or .env.vault live here now.
364
+
console.log(myObject) // values from .env
403
365
console.log(process.env) // this was not changed or written to
404
366
```
405
367
406
-
##### DOTENV_KEY
407
-
408
-
Default: `process.env.DOTENV_KEY`
409
-
410
-
Pass the `DOTENV_KEY` directly to config options. Defaults to looking for `process.env.DOTENV_KEY` environment variable. Note this only applies to decrypting `.env.vault` files. If passed as null or undefined, or not passed at all, dotenv falls back to its traditional job of parsing a `.env` file.
The engine which parses the contents of your file containing environment
@@ -483,22 +435,6 @@ Default: `false`
483
435
484
436
Override any environment variables that have already been set.
485
437
486
-
### Decrypt
487
-
488
-
The engine which decrypts the ciphertext contents of your .env.vault file is available for use. It accepts a ciphertext and a decryption key. It uses AES-256-GCM encryption.
Use [dotenv-vault](https://github.com/dotenv-org/dotenv-vault)
679
-
680
-
### What is a `.env.vault` file?
681
-
682
-
A `.env.vault` file is an encrypted version of your development (and ci, staging, production, etc) environment variables. It is paired with a `DOTENV_KEY` to deploy your secrets more securely than scattering them across multiple platforms and tools. Use [dotenv-vault](https://github.com/dotenv-org/dotenv-vault) to manage and generate them.
614
+
Use [dotenvx](https://github.com/dotenvx/dotenvx)
683
615
684
616
### What if I accidentally commit my `.env` file to code?
0 commit comments