-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Find config file with $CHEZMOI_CONFIG #2773
Conversation
This needs further work, especially on documentation and tests. I have yet had no time to consider what testing this might look like. |
I think that the code in this PR will cause the values read from the environment variables to be overwritten with values from the configuration file. I think the hook needs to happen at the end of |
It’s possible — even probable. I think that will require some additional thinking and tracking to identify where the value came from. On the other hand, if most of these values could be found in a configuration file, then the only thing that might be necessary is |
I’m reworking this so that some of the variable names better match the corresponding command-line flags and configuration (instead of Some inconsistencies as I’m looking through this:
Since most of the flags are available in the configuration file, I think we should mark the following flags as deprecated and remove them in Chezmoi v3:
With the deprecation of these flags, we can change this to only support What do you think @twpayne? |
90e8d74
to
10600cc
Compare
Resolves twpayne#2771 When `$CHEZMOI_CONFIG` to be set, chezmoi will act as if it were called with `chezmoi --config $CHEZMOI_CONFIG`. If both `$CHEZMOI_CONFIG` and `--config PATH-TO-CONFIG` are provided, the command-line flag wins.
10600cc
to
cf9d046
Compare
feat: Find config file with $CHEZMOI_CONFIGResolves #2771 When doc: Show config vars for global flagsdoc: Add JSONC configuration exampledoc: Improved information for config vars |
$CHEZMOI_CONFIG
$CHEZMOI_CONFIG
Sorry, I am against this PR. Currently chezmoi sets a wide range of environment variables for processes that it spawns. All of these variables begin with This PR adds a special environment variable which is the first and only one to be read by chezmoi. This is inconsistent with chezmoi's existing use of environment variables. I don't like configuration being set via environment variables as they are generally not trivially visible to the user (unlike, say command line arguments). I think the original problem is better solved with a wrapper script or alias. |
OK. Let me see what we can discuss on this:
That latter part is sort of what would be important to me—and why I thought this would be a worthwhile, as I regularly have |
Yes, both would be fantastic, thank you! |
Superseded by #2843. |
Closes #2771
This provides an alternative to pure command-line flag configuration when working with multiple source trees.