dotenv-rs / dotenv

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

dotenv! documentation does not match actual behaviour #71

Open bk138 opened 2 years ago

bk138 commented 2 years ago

Hi there, The README in https://github.com/dotenv-rs/dotenv/blob/master/README.md#usage states that

dotenv_codegen provides the dotenv! macro, which behaves identically to env!, but first tries to load a .env file at compile time.

However, I found v0.15 to only work with a .env file present and not getting any vars from the "real" environment, i.e. according to behaviour, the docs should state

dotenv_codegen provides the dotenv! macro, which behaves identically to env!, but instead tries to load a .env file at compile time.

Which one is correct, current docs or current implementation?

mblarsen commented 1 year ago

This indeed is an unexpected behavior. I cannot get any other value of that provided in .env at compile time. Cannot change the .env and cannot as you state provide the value through std env.