envparse
envparse copied to clipboard
read_envfile() recurses up the dir tree if path given, but file not found
When using read_envfile with path defined, the function still recurses up the directory tree if the given path is not found.
Consider the following code:
import envparse
envparse.env.read_envfile('myenv.conf')
The app runs from /home/test/code, which doesn't have myenv.conf file. The following debug log:
DEBUG:envfile not found at myenv.conf, looking in parent dir.
DEBUG:envfile not found at /home/test/myenv.conf, looking in parent dir.
DEBUG:envfile not found at /home/myenv.conf, looking in parent dir.
DEBUG:envfile not found at /myenv.conf, looking in parent dir.
UserWarning: Could not any envfile.
This is contrary to the documentation of the function. The function should not recurse if path is given, but file missing, or if it does this needs to be documented.