theskumar / python-dotenv

Reads key-value pairs from a .env file and can set them as environment variables. It helps in developing applications following the 12-factor principles.
https://saurabh-kumar.com/python-dotenv/
BSD 3-Clause "New" or "Revised" License
7.49k stars 425 forks source link

dotenv_values vs load_dotenv oddity #430

Open algaspar opened 1 year ago

algaspar commented 1 year ago

I set up a Django settings.py file to load RSA keys from a file into a dict with dotenv_values():

key_config = dotenv_values("path/to/file")

my_key = key_config['my_key'] my_key_id = key_config['my_key_id']

It worked fine in my original testing, but the next day it stopped working. I changed to using load_dotenv("path/to/file") and just having 'my_key' and 'my_key_id' as environment variables. That worked fine (and continues to work). I could not find any code changes and the file with my RSA keys remained the same in both instances.

Is there something that might have caused this behavior, or am I (likely) not seeing a change/typo in my code?

Thanks--

Al

bbc2 commented 1 year ago

I'm not aware of any change in our code that could have caused this. If you have more information about your environment, test file and the version of python-dotenv being used, that would be great.