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: add {MISE_CONFIG_DIR}/config.{MISE_ENV}.local.toml to config lookup #2783

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ in the current directory and parent directories.
These are intended to not be committed to version control.
(Add `.mise.local.toml` and `.mise.*.local.toml` to your `.gitignore` file.)

The priority of these files goes in this order (bottom overrides top):
The priority of these files goes in this order (bottom overrides top).

Global configuration files:

- `{MISE_CONFIG_DIR}/config.toml`
- `{MISE_CONFIG_DIR}/config.local.toml`
- `{MISE_CONFIG_DIR}/config.{MISE_ENV}.toml`
- `{MISE_CONFIG_DIR}/config.{MISE_ENV}.local.toml`
- `{MISE_CONFIG_DIR}/mise.{MISE_ENV}.toml`
- `{MISE_CONFIG_DIR}/mise.{MISE_ENV}.local.toml`

Local configuration files:

- `.config/mise/config.toml`
- `mise/config.toml`
- `mise.toml`
Expand Down
9 changes: 7 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,18 @@ pub fn global_config_files() -> Vec<PathBuf> {
}
};
let global_config = env::MISE_GLOBAL_CONFIG_FILE.clone();
if global_config.is_file() {
config_files.push(global_config);
let global_local_config = global_config.with_extension("local.toml");
for f in [global_config, global_local_config] {
if f.is_file() {
config_files.push(f);
}
}
if let Some(env) = &*env::MISE_ENV {
let global_profile_files = vec![
dirs::CONFIG.join(format!("config.{env}.toml")),
dirs::CONFIG.join(format!("config.{env}.local.toml")),
dirs::CONFIG.join(format!("mise.{env}.toml")),
dirs::CONFIG.join(format!("mise.{env}.local.toml")),
];
for f in global_profile_files {
if f.is_file() {
Expand Down
Loading