Skip to content

Pass http proxy as env to command (fix #136, #117) #147

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

Merged
merged 4 commits into from
Feb 24, 2019

Conversation

edvardchen
Copy link
Contributor

We use leetcode-cli and leetcode-cli uses request to call LeetCode web API.
It's lucky that request respects the http proxy env variables(http_proxy, https_proxy),
so all we need to do is passing proxy as env variable http_proxy to every command.

TODO: do we need to set https_proxy for https request?

@jdneo
Copy link
Member

jdneo commented Feb 22, 2019

Thank you @edvardchen for contribution.

So Is this PR aimed to fix #117 & #136

…ode-OpenSource#117)

We use leetcode-cli and leetcode-cli uses request to call LeetCode web API.
It's lucky that request respects the http proxy env variables(http_proxy, https_proxy),
so all we need to do is passing proxy as env variable http_proxy to every command.

TODO: do we need to set https_proxy for https request?
@edvardchen
Copy link
Contributor Author

Yes.

@jdneo
Copy link
Member

jdneo commented Feb 22, 2019

@edvardchen Awesome, I'll take a look later, thanks!

@jdneo jdneo self-requested a review February 22, 2019 01:51
@jdneo jdneo added this to the 0.11.0 milestone Feb 22, 2019
@jdneo
Copy link
Member

jdneo commented Feb 22, 2019

Hi @edvardchen

What will happen if we don't set https_proxy for https request

@edvardchen
Copy link
Contributor Author

request will use http_proxy as fallback

@edvardchen
Copy link
Contributor Author

Because vscode user setting doesn't have a https.proxy option, so we should not worry about it.

}

// clone process.env and add http proxy
export function createEnvOption(): {} {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like cpUtils.ts is a better place to put this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll move it there.

Copy link
Member

@jdneo jdneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jdneo jdneo merged commit 06e33d2 into LeetCode-OpenSource:master Feb 24, 2019
@jdneo
Copy link
Member

jdneo commented Feb 24, 2019

@edvardchen Thank you for your contribution!

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