jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
9.39k stars 263 forks source link

Support for $MISE_ENV in config file #1928

Open vanyauhalin opened 5 months ago

vanyauhalin commented 5 months ago

Hi Jeff. I have been using Mise and could not be happier. I have been pondering over an idea. Often, I find myself writing simple programs where the config file does not exceed a few lines.

$ cat .mise.toml
[tools]
go = "prefix:1.22"

$ cat .mise.production.toml
[tools]
go = "prefix:1.17"

Would not it be great if we could consolidate everything into a single file?

# [tools:{MISE_ENV}]

[tools]
go = "prefix:1.22"

[tools:production]
go = "prefix:1.17"

... or:

# [{MISE_ENV}.tools]

[tools]
go = "prefix:1.22"

[production.tools]
go = "prefix:1.17"

Personally, I prefer the first.

I think this aligns perfectly with the Mise philosophy. This tool was crafted to combine all vendor-specific dotfiles into a single entity. Similarly, we can apply this concept to define different environments.

jdx commented 5 months ago

Sorry but I don't see much value here over having separate files. The syntax that you've proposed would complicate the docs, schema, and parsing significantly so there is a real cost to adding something like this. I'll leave it open, but right now I'm not convinced this is a good idea.