-
Notifications
You must be signed in to change notification settings - Fork 172
feat: config to override env vars #341
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
Conversation
This breaks the API and backwards compatibility. I suggest that we refactor this into a breaking |
Are you sure it's a breaking change? I tried to make it compatible by making it a variadic parameter. I'm OK with updating this to make a v2 if you prefer, though. |
Ah, my bad. Missed the variadic bit. Let me test this out next week. Thank you. |
I think we might as well break to /v2 and remove the awkward
|
Sounds good, I'll update soon |
Should we stuff the callback and the prefix in Opt while we're at it since they're technically optional? |
Yep, we can do that. |
Updated for v2. Unfortunately, examples/go.mod can't be updated until v2 is pushed (unless we add |
|
Rebased. Apologies for asking you to hold my hand, but could you point out where in the README I missed updating the references to env? I thought I got everything. |
Friendly ping |
Ah, lost track of this. Will review and merge this week. |
Make a breaking change to the env.Provider function to use an Option struct to allow future extensions without breaking changes. Merge both transformation callbacks into a single callback. Add a config option to allow users to change the source of environment variables. Doing so is particularly useful in parallel tests where t.Setenv will not work.
- Removed the superfluous `..Opt` variadic argument. - Simplify `Provider()` init. - Improve comments.
- Switch to the `f()` pattern with an arg struct for better readability. - Add new test for non-string param value.
Reviewed and added a few commits with minor cosmetic improvements and updated your branch. Please take a look and confirm, and then we're good to merge. |
Everything looks good to me, thanks! |
Add a config option to env provider to allow users to change the source of environment variables. Doing so is particularly useful in parallel tests where t.Setenv will not work.