Add getenv_strict variant#10
Conversation
sorry for the lack of feedback. Yes i personally think it's a good addition. If you could add these i should be able to merge and make a release |
|
Thanks for looking into this @kit-ty-kate! I was just thinking about this PR last week and remembered it could be useful to also have a variant that uses a default value if the var lookup fails. Maybe we could do something like this? [%getenv "SOMETHING" {default="foo"}]
[%getenv "SOMETHING" {strict=true}]Not sure if this is the most appropriate syntax. Let me know what you think. |
|
The syntax looks good. The |
|
Great, I'll try to get this done soon. |
Hi! I often find the
getenvppx very useful, but one thing that is missing from it is the ability to statically fail when the environment variable is not set.This implements a new extension
getenv_strictthat encountering a missing environment variable will fail with:If you think this is a good addition, I'm happy to document this in the README and add a test case.