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

dotenvy cli doesn't work on Nix systems #122

Open
tqwewe opened this issue Sep 6, 2024 · 4 comments
Open

dotenvy cli doesn't work on Nix systems #122

tqwewe opened this issue Sep 6, 2024 · 4 comments

Comments

@tqwewe
Copy link

tqwewe commented Sep 6, 2024

I've installed the dotenvy cli with cargo install dotenvy --features="cli" on my Macbook which is setup with Nix. However when I try to execute dotenvy echo hi, I get an error:

error: failed to load environment: path not found

@allan2
Copy link
Owner

allan2 commented Sep 6, 2024

The default path is ".env" in the current dir. Try specifying the path.

@allan2
Copy link
Owner

allan2 commented Sep 6, 2024

You are probably using the published version, which is 0.15.7 or earlier. You can specify filename in that version using dotenvy -f env-file. The filename is searched for in the current directory and up the file tree.

You can also use the current git version, which takes a path instead of filename.

cargo install --features="cli" --git https://github.com/allan2/dotenvy dotenvy
dotenvy-f /path/to/file echo hi

@tqwewe
Copy link
Author

tqwewe commented Sep 6, 2024

Oops I don't know why I assumed this was a nix issue. I didn't even have a .env file defined, I just had assumed that dotenvy would silently ignore if there's no .env file and still run the command.

dotenvy -f ./.env echo hi works fine.

I did have an error when wrapping "echo hi" in quotes:

fatal: No such file or directory (os error 2)

Perhaps this error message could be improved to be:

Unknown command: 'echo hi'

Regardless thanks for the reply!

@tqwewe tqwewe closed this as completed Sep 6, 2024
@allan2 allan2 reopened this Sep 6, 2024
@allan2
Copy link
Owner

allan2 commented Sep 6, 2024

I must've broken the quoted command with my recent changes. I'll add optional file support and fix that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants