Skip to content

Commit

Permalink
Fix env loading in notebooks (#1266)
Browse files Browse the repository at this point in the history
In monorepos it's possible to have multiple `.databricks` folders, while
our extension will only put .env file in the root of the workspace.

In that case notebook bootstrap code was trying (and failing) to loading
`.env` file from the first `.databricks` folder.

This change makes sure we load the `.env` file from the first folder
that actually has it.
  • Loading branch information
ilia-db authored Jul 3, 2024
1 parent 937b46c commit 75e93c5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def wrapper(*args, **kwargs):
def load_env_from_leaf(path: str) -> bool:
curdir = path if os.path.isdir(path) else os.path.dirname(path)
env_file_path = os.path.join(curdir, ".databricks", ".databricks.env")
if os.path.exists(os.path.dirname(env_file_path)):
if os.path.exists(env_file_path):
with open(env_file_path, "r") as f:
for line in f.readlines():
key, value = line.strip().split("=", 1)
Expand Down

0 comments on commit 75e93c5

Please sign in to comment.