Skip to content

Commit a979e9a

Browse files
committed
chore: update README.md
1 parent 0bf0073 commit a979e9a

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,26 @@ Another .env file could be specified using the -e flag (this will replace loadin
3737
$ dotenv -e .env2 -- <command with arguments>
3838
```
3939

40-
Multiple .env files can be specified, and will be processed in order:
40+
Multiple .env files can be specified, and will be processed in order, but only sets variables if they haven't already been set. So the first one wins (existing env variables win over the first file and the first file wins over the second file):
4141
```bash
4242
$ dotenv -e .env3 -e .env4 -- <command with arguments>
4343
```
4444

4545
### Cascading env variables
46-
Some applications load from `.env`, `.env.development`, `.env.local`, and `.env.development.local`
47-
(see [#37](https://github.com/entropitor/dotenv-cli/issues/37) for more information).
48-
`dotenv-cli` supports this using the `-c` flag for just `.env` and `.env.local` and `-c development` for the ones above.
46+
Some applications load env variables from multiple `.env` files depending on the environment:
47+
48+
- `.env`
49+
- `.env.local`
50+
- `.env.development`
51+
- `.env.development.local`
52+
53+
dotenv-cli supports this using the `-c` flag:
54+
55+
- `-c` loads `.env` and `.env.local`
56+
- `-c test` loads `.env`, `.env.local`, `.env.test`, and `.env.test.local`
57+
58+
See [#37](https://github.com/entropitor/dotenv-cli/issues/37) for more information.
59+
4960
The `-c` flag can be used together with the `-e` flag. The following example will cascade env files located one folder up in the directory tree (`../.env` followed by `../.env.local`):
5061
```bash
5162
dotenv -e ../.env -c

0 commit comments

Comments
 (0)