Skip to content

Commit

Permalink
feat: add {MISE_CONFIG_DIR}/config.{MISE_ENV}.local.toml to config lo…
Browse files Browse the repository at this point in the history
…okup
  • Loading branch information
roele committed Oct 19, 2024
1 parent 86aa214 commit 4d43a09
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
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 vec![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

0 comments on commit 4d43a09

Please sign in to comment.