The System.put_env/1 call is pretty heavy-handed. It would be nice to allow an option to control whether values in an .env would overwrite existing ENV values or not. I'm thinking of use cases as straight-forward as this:
An .env has some values like:
LOG_LEVEL=warn
# other values...
and then you want to override a value, so you supply the value in the command, e.g.
LOG_LEVEL=debug iex -S mix
# or
LOG_LEVEL=debug _build/myapp
In both cases, the expectation is that the supplied ENV value would override anything already exported to the system.
Perhaps this option could be made available to the Dotenv.load functions, e.g.
Dotenv.load(".env", overwrite: true)
I think the default behavior would be to not overwrite existing values.