Skip to content

Commit 6b1d121

Browse files
committed
Swap .env.local and .env.<environment> priority
1 parent 344e7cd commit 6b1d121

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ dotenv -e .env3 -e .env4 <command with arguments>
3737
```
3838

3939
### Cascading env variables
40-
Some applications load from `.env`, `.env.local`, `.env.development` and `.env.development.local`
40+
Some applications load from `.env`, `.env.development`, `.env.local`, and `.env.development.local`
4141
(see [#37](https://github.com/entropitor/dotenv-cli/issues/37) for more information).
4242
`dotenv-cli` supports this using the `-c` flag for just `.env` and `.env.local` and `-c development` for the ones above.
4343

cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function printHelp () {
1717
' -v <name>=<value> put variable <name> into environment using value <value>',
1818
' -v <name>=<value> multiple -v flags are allowed',
1919
' -p <variable> print value of <variable> to the console. If you specify this, you do not have to specify a `command`',
20-
' -c [environment] support cascading env variables from `.env`, `.env.local`, `.env.<environment>`, `.env.<environment>.local` files',
20+
' -c [environment] support cascading env variables from `.env`, `.env.<environment>`, `.env.local`, `.env.<environment>.local` files',
2121
' command `command` is the actual command you want to run. Best practice is to precede this command with ` -- `. Everything after `--` is considered to be your command. So any flags will not be parsed by this tool but be passed to your command. If you do not do it, this tool will strip those flags'
2222
].join('\n'))
2323
}
@@ -41,7 +41,7 @@ if (argv.e) {
4141
if (argv.c) {
4242
paths = paths.reduce((accumulator, path) => accumulator.concat(
4343
typeof argv.c === 'string'
44-
? [`${path}.${argv.c}.local`, `${path}.${argv.c}`, `${path}.local`, path]
44+
? [`${path}.${argv.c}.local`, `${path}.local`, `${path}.${argv.c}`, path]
4545
: [`${path}.local`, path]
4646
), [])
4747
}

0 commit comments

Comments
 (0)