Skip to content
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

feat!: added MISE_OVERRIDE_CONFIG_FILENAMES config #3266

Merged
merged 1 commit into from
Nov 28, 2024
Merged

Conversation

jdx
Copy link
Owner

@jdx jdx commented Nov 28, 2024

Before this change, MISE_DEFAULT_CONFIG_FILENAME and MISE_DEFAULT_TOOL_VERSIONS_FILENAME accomplished 2 things where it should only have been doing one.
These commands both ignored "mise.toml"/".tool-versions" (but only that one filename) if set and also changed the default location for commands like mise use to write to.

This made it so you could not set MISE_DEFAULT_CONFIG_FILENAME=.mise.local.toml if you always want to use that file without also ignoring any "mise.toml" files.

This change adds 2 new env vars, MISE_OVERRIDE_CONFIG_FILENAMES and MISE_OVERRIDE_TOOL_VERSIONS_FILENAMES which can be arrays of filenames. If these are set, mise will not load any local filenames (globals are still loaded, use MISE_CONFIG_FILE to change that) and instead mise will use those filenames. For the common pattern of just wanting to ignore .tool-versions you can set MISE_OVERRIDE_TOOL_VERSIONS_FILENAMES=none

As part of this I also did something I wanted to do for a very long time: change MISE_PROFILE to MISE_ENV. mise will still read MISE_PROFILE though so that shouldn't be a breaking change for anyone.

Fixes #1901

BREAKING CHANGE:
This causes mise to start reading mise.toml if MISE_DEFAULT_CONFIG_FILENAME was set previously which it did not before.

This change also changes the behavior slightly for writing new config files. Before it was not consistent across commands like mise settings -l and mise use but now it will use the following order if no file exists and it needs to create one:

  • if MISE_DEFAULT_CONFIG_FILENAME is set, create that
  • if MISE_OVERRIDE_CONFIG_FILENAMES has anything, use the first.
  • if MISE_ENV is set, create "mise.$MISE_ENV.toml"
  • else, create "mise.toml"

If you have not been using any of these env vars nothing should change.

Before this change, MISE_DEFAULT_CONFIG_FILENAME and MISE_DEFAULT_TOOL_VERSIONS_FILENAME accomplished 2 things where it should only have been doing one.
These commands both ignored "mise.toml"/".tool-versions" (but only that one filename) if set and also changed the default location for commands like `mise use` to write to.

This made it so you could not set MISE_DEFAULT_CONFIG_FILENAME=.mise.local.toml if you always want to use that file without also ignoring any "mise.toml" files.

This change adds 2 new env vars, MISE_OVERRIDE_CONFIG_FILENAMES and MISE_OVERRIDE_TOOL_VERSIONS_FILENAMES which can be arrays of filenames. If these are set, mise will not load any local filenames (globals are still loaded, use MISE_CONFIG_FILE to change that) and instead mise will use those filenames. For the common pattern of just wanting to ignore .tool-versions you can set MISE_OVERRIDE_TOOL_VERSIONS_FILENAMES=none

Fixes #1901

BREAKING CHANGE:
This causes mise to start reading mise.toml if MISE_DEFAULT_CONFIG_FILENAME was set previously which it did not before.

This change also changes the behavior slightly for writing new config files. Before it was not consistent across commands like `mise settings -l` and `mise use` but now it will use the following order if no file exists and it needs to create one:

- if MISE_DEFAULT_CONFIG_FILENAME is set, create that
- if MISE_OVERRIDE_CONFIG_FILENAMES has anything, use the first.
- if MISE_ENV is set, create "mise.$MISE_ENV.toml"
- else, create "mise.toml"

If you have not been using any of these env vars nothing should change.
@jdx jdx merged commit 5a0508f into main Nov 28, 2024
21 checks passed
@jdx jdx deleted the config-override branch November 28, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding -l/--local flags and/or syncing command flags
1 participant