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

env._.source #1447

Closed
jdx opened this issue Jan 13, 2024 · 4 comments · Fixed by #1538
Closed

env._.source #1447

jdx opened this issue Jan 13, 2024 · 4 comments · Fixed by #1538

Comments

@jdx
Copy link
Owner

jdx commented Jan 13, 2024

Support sourcing bash files in [env]:

[env]
_.source = "./script.sh"

The variables exported within the script should be imported. This will require running scripts in bash. I'll make a separate ticket for other types of scripts/binaries.

@jdx jdx mentioned this issue Jan 13, 2024
@hahuang65
Copy link

Is the aim of this to replace direnv, essentially?

I've just installed mise and was under the impression that I could get rid of asdf and direnv.

However, it doesn't look like mise is currently compatible with .envrc files. Rather, mise provides it's own mechanism for env variables.

Our .envrc files have scripts to run inside them, which this seems to suggest supporting. I'd like to use mise as a replacement for asdf and direnv without forcing my co-workers to alter their development environments yet.

@jdx
Copy link
Owner Author

jdx commented Jan 22, 2024

there needs to be a lot more infra in place before mise could natively support envrc files. I'm also not sure that's the direction I would want to go. I generally like .tool-versions files but after being a direnv user for about a decade I really don't like the envrc format very much. I prefer something more declarative.

That said, if you really want envrc support a plugin would be capable of providing that with a bin/exec-env script. There is some caching things that would probably need to be addressed for it to work well which mise already has support for but it's not currently documented.

@hahuang65
Copy link

hahuang65 commented Jan 22, 2024

Curious. I've seen exec-env mentioned in the codebase a few times, but I haven't seen it in the documentation. Is there a link to it?

I'm really just after a way to re-use our .envrc files without having to port them over to .mise.toml since that would involve syncing changes between the two files, unless I convince my coworkers to use mise as well.

Also, seems like if I configure

[env]
_.source = ".envrc"

I get an error:

mise error parsing config file: ~/.mise.toml
mise expected value of env._.source to be a file or path, got: ".envrc"

@jdx
Copy link
Owner Author

jdx commented Jan 22, 2024

Curious. I've seen exec-env mentioned in the codebase a few times, but I haven't seen it in the documentation. Is there a link to it?

read the asdf plugin docs

I get an error:

this ticket is open.

@jdx jdx linked a pull request Jan 26, 2024 that will close this issue
@jdx jdx closed this as completed in #1538 Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants