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

Fragmented config does not respect MISE_CONFIG_DIR #3429

Closed
tmeijn opened this issue Dec 9, 2024 · 2 comments · Fixed by #3439
Closed

Fragmented config does not respect MISE_CONFIG_DIR #3429

tmeijn opened this issue Dec 9, 2024 · 2 comments · Fixed by #3439
Labels

Comments

@tmeijn
Copy link
Contributor

tmeijn commented Dec 9, 2024

Describe the bug
Fragmented configs, introduced in #3273, does not seem to respect MISE_CONFIG_DIR when set to a different path.

To Reproduce

❯ docker run -it --rm --entrypoint bash jdxcode/mise:v2024.12.3
root@8b111b333193:/mise# mkdir -p conf.d      
root@8b111b333193:/mise# echo "[tools]" >> conf.d/test.toml
root@8b111b333193:/mise# echo '"ubi:dummy/package" = "latest"' >> conf.d/test.toml 
root@8b111b333193:/mise# cat conf.d/test.toml 
[tools]
"ubi:dummy/package" = "latest"

root@8b111b333193:/mise# mise doctor
version: 2024.12.3 linux-arm64 (0e849fc 2024-12-08)
activated: no
shims_on_path: yes

build_info:
  Target: aarch64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS
  Built: Sun, 8 Dec 2024 17:17:14 +0000
  Rust Version: rustc 1.83.0 (90b35a623 2024-11-26)
  Profile: release

shell:
  (unknown)

dirs:
  cache: /mise/cache
  config: /mise
  data: /mise
  shims: /mise/shims
  state: ~/.local/state/mise

config_files:
  /mise/config.toml

backends:
  aqua
  asdf
  cargo
  core
  gem
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:

toolset:
  core:python@3.13.1

env_vars:
  MISE_DATA_DIR=/mise
  MISE_CACHE_DIR=/mise/cache
  MISE_CONFIG_DIR=/mise

settings:

No problems found

Note that the the config file is not on path.

Expected behavior
I would expect mise to pick up the created configuration file.

mise doctor output

root@8b111b333193:/mise# mise doctor
version: 2024.12.3 linux-arm64 (0e849fc 2024-12-08)
activated: no
shims_on_path: yes

build_info:
  Target: aarch64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS
  Built: Sun, 8 Dec 2024 17:17:14 +0000
  Rust Version: rustc 1.83.0 (90b35a623 2024-11-26)
  Profile: release

shell:
  (unknown)

dirs:
  cache: /mise/cache
  config: /mise
  data: /mise
  shims: /mise/shims
  state: ~/.local/state/mise

config_files:
  /mise/config.toml

backends:
  aqua
  asdf
  cargo
  core
  gem
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:

toolset:
  core:python@3.13.1

env_vars:
  MISE_DATA_DIR=/mise
  MISE_CACHE_DIR=/mise/cache
  MISE_CONFIG_DIR=/mise

settings:

No problems found

Additional context
Add any other context about the problem here. Consider running mise with --debug or --trace for extra debug info.

@tmeijn tmeijn added the bug label Dec 9, 2024
@syhol
Copy link
Contributor

syhol commented Dec 9, 2024

If MISE_DATA_DIR=/mise then .config/mise/conf.d/*.toml would resolve to /mise/.config/mise/conf.d/*.toml.

If I do this it works

docker run -it --rm --entrypoint bash jdxcode/mise:v2024.12.3
root@01cec1b8c428:/mise# mkdir -p .config/mise/conf.d     
root@01cec1b8c428:/mise# echo "[tools]" >> .config/mise/conf.d/test.toml
root@01cec1b8c428:/mise# echo '"ubi:dummy/package" = "latest"' >> .config/mise/conf.d/test.toml 
root@01cec1b8c428:/mise# cat .config/mise/conf.d/test.toml 
[tools]
"ubi:dummy/package" = "latest"
root@8b111b333193:/mise# mise doctor
version: 2024.12.3 linux-arm64 (0e849fc 2024-12-08)
activated: no
shims_on_path: yes

build_info:
  Target: aarch64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS
  Built: Sun, 8 Dec 2024 17:17:14 +0000
  Rust Version: rustc 1.83.0 (90b35a623 2024-11-26)
  Profile: release

shell:
  (unknown)

dirs:
  cache: /mise/cache
  config: /mise
  data: /mise
  shims: /mise/shims
  state: ~/.local/state/mise
mise /mise/.config/mise/conf.d/test.toml is not trusted. Trust it? Yes

config_files:
  /mise/config.toml
  /mise/.config/mise/conf.d/test.toml

backends:
  aqua
  asdf
  cargo
  core
  gem
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:
mise WARN  failed to resolve toolset: [/mise/.config/mise/conf.d/test.toml] ubi:dummy/package@latest: HTTP status client error (404 Not Found) for url (https://api.github.com/repos/dummy/package/releases)

toolset:
  core:python@3.13.1

env_vars:
  MISE_DATA_DIR=/mise
  MISE_CACHE_DIR=/mise/cache
  MISE_CONFIG_DIR=/mise

settings:

No problems found

It looks like the .config/mise/ bit is not optional and must come after MISE_CONFIG_DIR, which makes sense to me.

@jdx
Copy link
Owner

jdx commented Dec 9, 2024

It looks like the .config/mise/ bit is not optional and must come after MISE_CONFIG_DIR, which makes sense to me.

hmm no I think OP is right here. I would expect MISE_CONFIG_DIR=/foo to use /foo/conf.d/*.toml

jdx added a commit that referenced this issue Dec 9, 2024
jdx added a commit that referenced this issue Dec 9, 2024
@jdx jdx closed this as completed in #3439 Dec 9, 2024
jdx added a commit that referenced this issue Dec 9, 2024
* fix: read MISE_CONFIG_DIR/conf.d/*.toml configs

Fixes #3429

* fix: read MISE_CONFIG_DIR/conf.d/*.toml configs

Fixes #3429

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants