teamxenox / devtocli

👩🏻‍💻 Browse and Search Dev.to Posts from Command Line
https://teamxenox.github.io/devtocli/
MIT License
142 stars 9 forks source link

Add proxy support #5

Closed mamyn0va closed 5 years ago

mamyn0va commented 5 years ago

Would it be possible to add a proxy arg to allow the CLI to work behind a corporate proxy?

sarthology commented 5 years ago

Can you explain?

mamyn0va commented 5 years ago

Would it be possible to add a proxy arg to allow the CLI to work behind a corporate proxy?

pavanjadhaw commented 5 years ago

There's way to do that, you can set proxy before running this cli app.

export the below variables in terminal

export http_proxy='http://proxyServerSddress:proxyPort'    
export https_proxy='https://proxyServerSddress:proxyPort'

Then run devtocli

devto

and use the following commands to disable proxy

unset http_proxy
unset https_proxy
mamyn0va commented 5 years ago

My term already has proxy vars but the CLI fails with the following error:

(node:19473) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 151.101.2.217:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1088:14)
(node:19473) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:19473) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Unhandled rejection Error: connect ECONNREFUSED 151.101.2.217:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1088:14)

  👩🏻‍💻 Fetching Awesome content...  
jbutz commented 5 years ago

Node's built in libraries don't automatically respect the *_proxy environment variables. It's something we have to deal with a lot at one enterprise customer I deal with.

I hope to have a PR up for this before too long, just need to test it on a system that requires a proxy.

mamyn0va commented 5 years ago

I can test your PR if you want.

jbutz commented 5 years ago

@mamyn0va, please do. I just put up the PR

mamyn0va commented 5 years ago

I'll do it tomorrow, thanks.

mamyn0va commented 5 years ago

@jbutz it's all good for me !

Capture d'écran Deepin_zone de sélection _20190830144652

sarthology commented 5 years ago

That's Awesome.