Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search parent directories for .env file if one is not in the current working directory #16

Open
jbowers85 opened this issue Apr 30, 2024 · 2 comments

Comments

@jbowers85
Copy link

My use case is such that my working directory is set to a child folder within my repo (this is due to databricks default settings). When running load_dot_env(), if no .env file is found in the working directory, it would be great if parent directories could be searched for an .env file until one is located.

In my case my working directory is something like: "/Workspace/Repos/foo.bar@company.com/my_repo/project/src", while my .env file is located in "/Workspace/Repos/foo.bar@company.com/my_repo".

Perhaps the logic would just use the first .env file found.

@gaborcsardi
Copy link
Owner

That is reasonable, but unfortunately it is also a breaking change, so we'd need a way for people to opt-in into the new behavior.

@jbowers85
Copy link
Author

jbowers85 commented May 3, 2024

That makes sense. I've created a pull request that allows users to opt-in to recursive search.

Pull Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants