Add dotenv-filename
and dotenv-path
to in-justfile
settings
#1692
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
I was trying to load a
.env
file located in another directory from multiple otherjustfile
s for a project with a lot of repositories earlier and couldn't find any way to do that in the documentation.After checking the code, I found the
--dotenv-filename
and--dotenv-path
arguments that did exactly what I needed to do (introduced in #941), but it was impossible to set those options in thejustfile
directly.Changes
This pull request pretty much makes the
--dotenv-filename
and--dotenv-path
available as settings that can be set using theset
keyword in ajustfile
.The implementation of the
load_dotenv
function was modified so that it considers these new settings, on top of the already existing program arguments. The program arguments take precedence over the settings in thejustfile
.The documentation in
README.md
was updated to reflect those changes.Caveats
I found out right before creating this PR that there was already a pull request (#1640) and a few open issues about this topic (#945), and did not take them into account during implementation. There's some very good ideas floating in these, but my PR just exposes the existing program arguments as settings.
I did not update the documentation in
README.中文.md
since I cannot read or write Chinese.