feat(rpc): support set http proxy from env #9587
Open
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.
Description
This PR supports setting HTTP proxy through environment variables like
GLOBAL_AGENT_HTTP_PROXY
.Motivation
When I ran the following commands,
Always give me errors:
(Error#1) Error#1: cannot get network config (main): request to https://main.agoric.net/network-config failed, reason: read ECONNRESET at file:///home/xxx/Agoric/agoric-sdk/packages/agoric-cli/src/lib/rpc.js:43:11 at async file:///xxx/Agoric/agoric-sdk/packages/agoric-cli/src/lib/rpc.js:52:23
I know this is due to a network problem, my network has a lot of limits, but we can use an HTTP proxy to fix the issue.
Documentation Considerations
If this PR is ok with you, we can add a doc to tell users how to set the HTTP proxy if they are facing a network issue like me
Testing Considerations
There are test cases that ensure old functions work well.
This PR only affects when an env var like
GLOBAL_AGENT_HTTP_PROXY
is set. After I set theGLOBAL_AGENT_HTTP_PROXY
value, now it works for me: