dotenv-run icon indicating copy to clipboard operation
dotenv-run copied to clipboard

Loading Priorities not working as documented with multiple files scenario: .env .secrets

Open xmlking opened this issue 1 year ago • 2 comments

I am trying following scenario: Loading Priorities works : .env, .env.local, .env.prod <--- this works for .env Loading Priorities not working with two files: .env, .env.local, .env.prod, .secrets, .secrets.prod <-- this not working with both .env and .secrets files

Expected MY_SECRET=prod (which is defined in .secrets.prod) but got MY_SECRET=dev (which is defined in .secrets)

NODE_ENV=prod dotenv-run -f .env -f .secrets -v '.*' -u            
---------------------------------
- Root directory:  /Users/xxx/Work/SPA/signals
- Working directory:  /Users/xxx/Work/SPA/signals
- Files: .env, .secrets
- Environment: prod
- Environment files: 
 ✔ /Users/xxx/Work/SPA/signals/.env.prod
 ✔ /Users/xxx/Work/SPA/signals/.env.local
 ✔ /Users/xxx/Work/SPA/signals/.env
 ✔ /Users/xxx/Work/SPA/signals/.secrets.prod
 ✔ /Users/xxx/Work/SPA/signals/.secrets
- Environment variables: .* (Unsecure Mode)

xmlking avatar May 01 '24 19:05 xmlking

image image image image image

xmlking avatar May 01 '24 19:05 xmlking

Expected MY_SECRET=prod (which is defined in .secrets.prod) but got MY_SECRET=dev (which is defined in .secrets)

I guess here MY_SECRET is rather defined in one of the .env.* files which are loaded before as the output shows.

What is the debug output (the loading priorities) you expect:

NODE_ENV=prod dotenv-run -f .env -f .secrets -v '.*' -u            
---------------------------------
- Root directory:  /Users/xxx/Work/SPA/signals
- Working directory:  /Users/xxx/Work/SPA/signals
- Files: .env, .secrets
- Environment: prod
- Environment files: 
???
- Environment variables: .* (Unsecure Mode)

chihab avatar May 31 '24 10:05 chihab