-
Notifications
You must be signed in to change notification settings - Fork 781
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
Add a envOrDefault helper #829
Comments
Hi @nikkau You should be able to use the built-in {{ or (env "TIMEOUT_CONNECT") "5s" }} Does that work? |
Hi, It works, but
I don't know if someone need this stricter behavior (today I don't, the "or pattern" does the trick). I also think explicit helper have value for the sake of explicitness, for coherence with the existence of |
Hi @nikkau Thank you for your response. I am going to close this out until someone has a stricter use case. Thanks! |
Hello, I was searching high and low for this answer. I would like to make it easier for the next person to find. Can I make a PR to update the docs and add this example? The another option would be to make the |
Sure @dfredell we'd welcome that! |
I also had a very hard time finding the solution to this. I'd like to submit a PR to add the envOrDefault helper. |
@jtrinklein, if you'd like to submit a PR with this feature I'll happily review it for possible inclusion. Please remember tests. Thanks. |
…helper Fix/master: add envOrDefault helper Fixes #829
Feature Request
For a new project we use a bench of
{{ if env "TIMEOUT_CONNECT" }}{{ env "TIMEOUT_CONNECT" }}{{ else }}5s{{ end }}
which is a bit verbose and redundant.It would be very conveniant to use a syntax like
{{envOrDefault "TIMEOUT_CONNECT" "5s"}}
It should be trivial to implement, I can make a pull request if you are ok with it.
The text was updated successfully, but these errors were encountered: