From 6b1d121086b82b4066d33516a67b708673338dc5 Mon Sep 17 00:00:00 2001 From: helloitsjoe Date: Wed, 1 Jun 2022 21:02:00 -0400 Subject: [PATCH] Swap .env.local and .env. priority --- README.md | 2 +- cli.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ea14ad9..a6f8208 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ $ dotenv -e .env3 -e .env4 ``` ### Cascading env variables -Some applications load from `.env`, `.env.local`, `.env.development` and `.env.development.local` +Some applications load from `.env`, `.env.development`, `.env.local`, and `.env.development.local` (see [#37](https://github.com/entropitor/dotenv-cli/issues/37) for more information). `dotenv-cli` supports this using the `-c` flag for just `.env` and `.env.local` and `-c development` for the ones above. diff --git a/cli.js b/cli.js index 6a4aad8..0372770 100755 --- a/cli.js +++ b/cli.js @@ -17,7 +17,7 @@ function printHelp () { ' -v = put variable into environment using value ', ' -v = multiple -v flags are allowed', ' -p print value of to the console. If you specify this, you do not have to specify a `command`', - ' -c [environment] support cascading env variables from `.env`, `.env.local`, `.env.`, `.env..local` files', + ' -c [environment] support cascading env variables from `.env`, `.env.`, `.env.local`, `.env..local` files', ' 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' ].join('\n')) } @@ -41,7 +41,7 @@ if (argv.e) { if (argv.c) { paths = paths.reduce((accumulator, path) => accumulator.concat( typeof argv.c === 'string' - ? [`${path}.${argv.c}.local`, `${path}.${argv.c}`, `${path}.local`, path] + ? [`${path}.${argv.c}.local`, `${path}.local`, `${path}.${argv.c}`, path] : [`${path}.local`, path] ), []) }