dotenv-path unexpectedly loads .env from parent directory
- Dominant language
- Rust
- Stars
- 35.8k
- Forks
- 846
- Avg merge
- 27m
- Merged PRs (30d)
- 3
Description
I'm using just@1.31.0 on Mac.
The documentation states:
> If dotenv-path is set, just will look for a file at the given path, which may be absolute, or relative to the working directory.
> dotenv-filename and dotenv-path and similar, but dotenv-path is only checked relative to the working directory, whereas dotenv-filename is checked relative to the working directory and each of its ancestors.
I tried configuring my justfile as follows:
```
set dotenv-path := "."
_default:
@just --list
```
There is no `.env` file in the current directory, but in the parent directory, I created a bogus `.env` file, e.g.
```
daofinasdfoiasdn
```
In the current directory with my `justfile`, I get this error:
```
just
error: Failed to load environment file: Error parsing line: 'daofinasdfoiasdn', error at line index: 16
```
Expectation: `dotenv-path` should only load a `.env` file from the specified path.
Contributor guide
Assessment
This issue has not been assessed yet.