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.
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
Support http proxy configuration via env variables #2850
Support http proxy configuration via env variables #2850
Changes from 2 commits
cfc1c4f
5dafc84
61e6361
83cbea9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine as is but if some other code previously set :connect_options, they'd be overridden. I don't have a solution for this in Req, there's just an issue as a reminder: wojtekmach/req#319.
I think ideally it'd be as easy as:
but it of course assumes the nested structure is already there. I guess what I'm trying to say is it would be nice if there's a language feature that makes above easy or at least if there's a Req feature. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually did check if
Req.merge
would handle it recursively, and then considered doing deep merge withreq.options[:connect_options]
, but since we don't specifyconnect_options
anywhere else, I ended up ignoring it.Instead of making the replace/merge behaviour specified at option registration, we could shift the decision to the caller, as in
Req.Request.deep_merge_options
(or an option tomerge_options
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having a separate function for deep merge is interesting, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curl only uses
HTTP_PROXY
for http requests andHTTPS_PROXY
for https requests, however:httpc
uses:proxy
as the default for:https_proxy
, so I mirrored:httpc
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an aside, in Req I have a few shortcuts like the following, these two calls are equivalent:
cacerts/cacertfile seems maybe common enough to warrant such shortcut but tbh I don't know where to draw the line, I'm kind of wary of adding a lot of top-level options and are looking into nesting (livebook-dev/req_athena#40 (comment)) but then this is already nested but like too nested? Curious if any of this resonate with you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion, I don't think we need to rush into more top-level shortcuts. Though with #394 it may be a better argument to be able to specify proxy and certs on the same level.