Skip to content
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 callback to parse(). #371

Closed

Conversation

ericsnowcurrently
Copy link

@ericsnowcurrently ericsnowcurrently commented Feb 5, 2019

There are a couple of use cases in which dotenv.parse() doesn't quite meet my needs:

  • when I need to see the value from each valid line; sometimes an env var is set multiple times but currently I only get the last entry (I need them all)
  • when the the order from the .env file matters

This change addresses those by adding a callback to parse() which gets called with the key/value pair for each valid env var line. This could also be done with an iterator that gives the key/value pairs (and parse() would use that), but a callback seemed simpler.

@maxbeatty
Copy link
Contributor

This use case is pretty far from the intended purpose of parse. Might be better off copying our code for your specific needs.

@maxbeatty maxbeatty closed this Feb 6, 2019
@ericsnowcurrently
Copy link
Author

Fair enough. I'd already adapted your code locally but wanted to play nice. :)

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

Successfully merging this pull request may close these issues.

2 participants