Skip to content

Add --envrc-dir flag to allow specifying location of direnv config #2629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pstephan-geico-external

Summary

Fixes #2459 - devbox generate direnv does not respect --config

It seems that the previous mode of operation for devbox generate direnv --config <some-dir> used --config to determine the location of the resulting .envrc file, rather than as the location of the devbox.json file. But in some cases it is desired to be able to specify not only the location of not only the direnv .envrc file, but also the devbox config file. Or at least to be able to specify just the location of the devbox config with the .envrc being in the current directory.

To accomplish this, without breaking the current mode of operation, a new parameter is added, --envrc-dir, which specifies the location of the resulting .envrc file. For example, the command devbox generate direnv --envrc-dir ABC --config ABC/XYZ would create ABC/.envrc and within that would be the command eval "$(devbox generate direnv --print-envrc --config XYZ)"

Without the new --envrc-dir param, operation is the same as it was previously, even with the --config (which will be used to specify the location of the .envrc file, NOT the devbox config file, devbox.json.

How was it tested?

Several new tests have been created to cover cases with and without the new --envrc-dir param.

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.

By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.

Copy link

@darch-geico-external darch-geico-external left a comment

Choose a reason for hiding this comment

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

I think I only spotted one actual bug.

Copy link

@darch-geico-external darch-geico-external left a comment

Choose a reason for hiding this comment

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

Obviously still needs review from an actual maintainer, but I don't see any other issues from here.

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

Successfully merging this pull request may close these issues.

devbox generate direnv does not respect --config
2 participants