Skip to content

fix(macros): don't look for .env outside workspace#4282

Open
abonander wants to merge 1 commit into
mainfrom
ab/env-loading
Open

fix(macros): don't look for .env outside workspace#4282
abonander wants to merge 1 commit into
mainfrom
ab/env-loading

Conversation

@abonander
Copy link
Copy Markdown
Collaborator

Does your PR solve an issue?

Fixes #4276

Is this a breaking change?

This reverts a behavior change to match previous releases, so it would be considered a bugfix and thus non-breaking.

@abonander
Copy link
Copy Markdown
Collaborator Author

@gabe-lepo @rnestler can you try this out and let me know if it fixes the bug please?

Comment on lines +119 to +122
manifest_dir
.ancestors()
.take_while(|dir| dir.starts_with(workspace_root))
.collect::<Vec<_>>()
Copy link
Copy Markdown
Collaborator Author

@abonander abonander May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that if the project has a structure like this, for example:

/
├── crates/
│   ├── foo/
│   │   └── .env
│   ├── bar/
│   │   └── .env
│   └── .env
└── .env

When compiling foo we'll read /crates/foo/.env, /crates/.env and /.env in that order.

@gabe-lepo
Copy link
Copy Markdown

@abonander I can confirm its working on my end. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLx attempts to read unrelated parent directory .env

2 participants