dotenv-rs / dotenv

Library to help supply environment variables in testing and development
MIT License
566 stars 45 forks source link

any way to get only values in the dotenv file? #70

Open amitavaghosh1 opened 3 years ago

amitavaghosh1 commented 3 years ago

More of a help question.

Is there any way to get only the key, values in the .env file? right now, in the examples one has to go over all std env vars. which is not great I suppose. The only way I see is to keep a track of the list of keys in .env separately in a Vector in the code

daboross commented 2 years ago

This is possible with the dotenv::dotenv_iter method. It seems to be deprecated now, but that's why it existed before, at least: so you can get dotenv vars without loading them into std env nor iterating over non-dotenv env vars.