Skip to content

Example on dotenv-load usage #2720

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

Closed
KnightArthurRen opened this issue Apr 23, 2025 · 2 comments
Closed

Example on dotenv-load usage #2720

KnightArthurRen opened this issue Apr 23, 2025 · 2 comments

Comments

@KnightArthurRen
Copy link

Hi guys, as titled does anyone have a good example on how to use the dotenv-load feature? I couldn't quite find the documentation around it. Does it load the file into env variables and the just file can use or does it load it into justfile variables.

I have the following .env

env=TEST

When I try to access it in the just file

set dotenv-load := true
set dotenv-path := ".env" -> redundant 

test-env:
    @echo "ENV is $ENV" -> does not work, variable is unbounded

test-variable:
    @echo "ENV is {{ENV}}" -> does not work, variable is not defined

I'm wondering where are the env variables loaded and how can I access them inside the just file?

Thank you

@laniakea64
Copy link
Contributor

Environment variable names are case-sensitive. This should work with your .env file:

set dotenv-load := true
set dotenv-path := ".env" # redundant 

test-env:
    @echo "ENV is $env"

@KnightArthurRen
Copy link
Author

Ah got it thank you @laniakea64 !

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