Add 'get_dotenv/3' and 'fetch_dotenv!/2'#33
Open
arcanemachine wants to merge 1 commit into
Open
Conversation
These wrapper functions provide idiomatic naming that mirror the behavior of `System.get_env/2,3` and `System.fetch_env!/2`. Names were chosen to avoid collision with the `System` function names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These wrapper functions provide idiomatic naming behavior that mirrors that of
System.get_env/2,3andSystem.fetch_env!/2.I added these because I was often getting confused between the different
Dotenvy.env!functions (which one to use, and when), and harmonizing them against the style used by System get_env/fetch_env! built-ins made a lot of that confusion go away from me.Names were chosen to avoid collision and confusion with the built-in
Systemfunction names, since Dotenvy is conventionally imported inconfig/runtime.exsinstead of being aliased. This allows a new reader to know that the imported function is a Dotenvy env getter (e.g.get_dotenv/3) at a glance, not the built-in System one (e.g.System.get_env/3).This pull request does not replace or remove any existing functionality, but instead extends it for the sake of improved (in my opinion, at least) ergonomics.
The changes are summarized by the addition made to the cheatsheet:
Thanks!