You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
This is an annoying consequence of the way that the various dotenv settings work.
Setting any dotenv- setting turns on dotenv loading, which uses bothdotenv-filename and dotenv-path. dotenv-filename defaults to .env, so even if you set dotenv-path, just will still also try to use dotenv-filename to load an environment file.
So, even though you set dotenv-path := ".", dotenv-filename still has the default value of .env, and the environment file in the parent directory is loaded.
This is definitely not ideal behavior, and if I could go back in time, I would definitely make dotenv-filenmae and dotenv-path not have default values, which would enable you to get the behavior you want.
Part of the reason that these settings are weird and continue to be weird is that someone could be relying on the existing behavior, and so changing them to be less weird might break someone's setup.
Probably the best way to fix this would be to introduce a new setting (sigh) which if used would provide better behavior.
I'm using just@1.31.0 on Mac.
The documentation states:
I tried configuring my justfile as follows:
There is no
.env
file in the current directory, but in the parent directory, I created a bogus.env
file, e.g.In the current directory with my
justfile
, I get this error:Expectation:
dotenv-path
should only load a.env
file from the specified path.The text was updated successfully, but these errors were encountered: