Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

if conditional with environment variable is always true unless blank #78

Open
kylegibson opened this issue Nov 28, 2022 · 0 comments
Open

Comments

@kylegibson
Copy link

I discovered that if you want a true/false with a environment variable, the only combination that matters is whether the value is set or not:

foo.env:

test_1=false
test_2=False
test_3=1
test_4=

test.sh:

{% if test_1 %}echo 1{% endif %}
{% if test_2 %}echo 2{% endif %}
{% if test_3 %}echo 3{% endif %}
{% if test_4 %}echo 4{% endif %}

Result:

$ j2 test.sh foo.env
echo 1
echo 2
echo 3

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

No branches or pull requests

1 participant