mise icon indicating copy to clipboard operation
mise copied to clipboard

Support for global configuration profiles

Open toupeira opened this issue 1 year ago • 2 comments

Background

I use my dotfiles on several machines, only some of which I use for software development.

I'd like to have one global configuration for "default" tooling (like FZF), and a development profile for some programming languages and development tools I want to have available globally, outside of a project context.

I tried adding a ~/.config/mise/config.development.toml and setting MISE_ENV=development, and this works fine but only when I'm inside $HOME.

https://mise.jdx.dev/profiles.html only mentions that profiles are looked up in the current directory, so this seems to be by design.

Proposal

Would you consider extending the lookup to $HOME as well? Not sure if this should be behind an opt-in setting, or maybe using a different MISE_GLOBAL_ENV variable.

Also let me know if there's a better way to do what I want. Right now I work around this by using a single config and setting $MISE_DISABLE_TOOLS instead depending on the hostname, but this will be more annoying to manage as I add more plugins.

toupeira avatar Mar 29 '24 19:03 toupeira

I'd love this as well, e.g. for dealing with AWS profiles universally:

~/.config/mise/config.dev.toml

[env]
AWS_PROFILE = "dev"
AWS_REGION = "us-foo-1"

~/.config/mise/config.prod.toml

[env]
AWS_PROFILE = "prod"
AWS_REGION = "eu-bar-1"

~/.config/mise/config.toml

[tasks."aws-whoami"]
run = "aws --region=${AWS_REGION} sts get-caller-identity"

⬆️ would use AWS_PROFILE based on MISE_ENV

milas avatar Jun 28 '24 16:06 milas

Seems like a solid proposal from me 👍

jdx avatar Jun 28 '24 16:06 jdx

@toupeira A global -P, --profile flag has been introduced with #1973. Not quite sure i can follow what you're trying to achieve here but given following scenario, mise -C /tmp/mise/project -P dev ls would show tools from both files.

/tmp
└─ mise
    ├─ mise.dev.toml
    ├─ project
    └─── .mise.toml

Guess the the documentation in Profiles should be updated since profiles are looked up in parent directories as well.

roele avatar Sep 13 '24 15:09 roele

@roele thanks! Gave it a quick try but -P seems to work the same as $MISE_ENV, i.e. the lookup only covers parent directories, but not $HOME.

I'd like to be able to have certain tools globally available (i.e. in all directories, not just $HOME and children), but only on certain machines.

It's really a minor wishlist feature request for me though, I've found my workaround of setting $MISE_DISABLE_TOOLS depending on the hostname quite workable.

toupeira avatar Sep 14 '24 13:09 toupeira

@toupeira I see, so given my example of a project in /tmp, a $MISE_CONFIG_DIR/config.dev.toml file should also be taken into account.

roele avatar Sep 14 '24 15:09 roele

@roele exactly, yes! Thanks for opening a PR :heart:

toupeira avatar Sep 14 '24 16:09 toupeira