Skip to content

Commit 1259e30

Browse files
committed
add dotenvx environments example
1 parent 57c46be commit 1259e30

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,35 @@ You need to deploy your secrets in a cloud-agnostic manner? Use a `.env.vault` f
190190

191191
## 🌴 Manage Multiple Environments
192192

193-
Use [dotenv-vault](https://github.com/dotenv-org/dotenv-vault).
193+
Use [dotenvx](https://github.com/dotenvx/dotenvx) or [dotenv-vault](https://github.com/dotenv-org/dotenv-vault).
194+
195+
### dotenvx
196+
197+
Run any environment locally. Create a `.env.ENVIRONMENT` file and use `--env-file` to load it. It's straightforward, yet flexible.
198+
199+
```bash
200+
$ echo "HELLO=production" > .env.production
201+
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
202+
203+
$ dotenvx run --env-file=.env.production -- node index.js
204+
Hello production
205+
> ^^
206+
```
207+
208+
or with multiple .env files
209+
210+
```bash
211+
$ echo "HELLO=local" > .env.local
212+
$ echo "HELLO=World" > .env
213+
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
214+
215+
$ dotenvx run --env-file=.env.local --env-file=.env -- node index.js
216+
Hello local
217+
```
218+
219+
[more environment examples](https://dotenvx.com/docs/quickstart/environments)
220+
221+
### dotenv-vault
194222

195223
Edit your production environment variables.
196224

0 commit comments

Comments
 (0)