I found the way, which I think, is the most elegant, to check if environment variable is defined.
foo:
@test {{ env("FOO") }}
If FOO is not defined, it will fail:
error: Call to function `env` failed: environment variable `FOO` not present
——▶ Justfile:2:12
│
2 │ @test {{ env("FOO") }}
│ ^^^
Maybe there is a build-in way, but I wasn't able to find it. I want it to be checked for a single recipe, not for the whole file.
Top comments (0)