Comments (8)
Hey @kuzmik,
First of all, thanks for using diplomat! Thats an interesting use case, not something I've come across before. I'll take a look a little later to see if I can come up with a solution for you.
JH
from diplomat.
Hey @kuzmik
Using Faraday on its own you can set a proxy as such:
Faraday.new(:proxy => 'http://proxy.example.com:80')
Faraday.new(:proxy => {
:uri => 'http://proxy.example.com',
:user => 'foo',
:password => 'bar'
})
Now I haven't tested this, but I'd be willing to bet that setting :proxy
to nil
would stop it using any proxy environment variable. Could you run a test where you try to run Faraday on its own and setting proxy to nil? If that works, I think we can make a fix for you to set your own parameters.
from diplomat.
Sure, I will give it a whirl sometime today and let you know what happens!
from diplomat.
Setting to nil doesn't do the trick... but setting it to '' does. Weird.
[16] pry(main)> conn = Faraday.new(:url => 'https://localhost:30570', :proxy => nil).proxy => #<struct Faraday::ProxyOptions uri=#<URI::HTTP:0x00000002530b40 URL:http://webproxy:3128>, user=nil, password=nil>
[17] pry(main)> conn = Faraday.new(:url => 'http://localhost:30570', :proxy => '').proxy => #<struct Faraday::ProxyOptions uri=#<URI::Generic:0x0000000291cbc8 URL:>, user=nil, password=nil> [18] pry(main)>
from diplomat.
Hey @kuzmik sorry I didn't get back to this message - how rude of me!
It seems based on what you sent me that the issue is with Faraday, not with diplomat - if you find that's not the case please reopen this thread and I'll work with you to get the problem resolved.
Thanks!
JH
from diplomat.
We have the same situation where Faraday is using ENV http_proxy (and ignoring ENV no_proxy) to connect to consul running on localhost via the proxy which results in HTTP 502's. Could we get Diplomat to force Faraday into not using the proxy?
from diplomat.
Hey @literatesnow! Looking through Faraday's Issues list, it seems like this PR will do exactly what you need: lostisland/faraday#471. Because the issue is coming from Faraday, it needs to be fixed in Faraday in order for this to work.
In the meantime, you can use @kuzmik's findings (setting :proxy => ''
in Faraday's connection) to query with the proxy explicitly turned off for consul. You might do it like this:
@faraday = Faraday.new(:url => 'http://localhost:8500', :proxy => '')
@diplomat_kv = Diplomat::Kv.new(@faraday)
@diplomat_kv.get('lorem')
You could probably turn that idea into a wrapper class which you could use in the meantime to keep your code clean until this issue is fully resolved.
I think the long-term goal to fix this should be to swap out Faraday with Hurley as it seems to be under active maintenance as opposed to Faraday which seems to be effectively deprecated. However that would be a breaking change for people who use Faraday's middlewares, and for that reason, we have to either wait until someone comes along with an adapter for Faraday middleware (not an unlikely thing to happen) or release a major and breaking revision.
from diplomat.
@johnhamelink Thanks very much for the workaround, I'll use it in the meantime (was missing the Diplomat::Kv.new part).
from diplomat.
Related Issues (20)
- /v1/catalog/register is broken after upgrade to v2.1.2 HOT 1
- Support Consul 1.4.0+ ACL system HOT 2
- Add support for Consul 1.5.x ACL tokens HOT 2
- Add support for Consul 1.5.x Auth Method and Binding Rule HTTP APIs HOT 2
- Improve error message in case of missing ACL
- 2.3.0: syntax error in file lib/diplomat/rest_client.rb:243 ? HOT 4
- It is unable to retrieve service configuration from consul HOT 2
- Add support for Operator Autopilot API HOT 5
- Due to faraday 1.1 release diplomat only works on ruby 2.4+
- Unable to use multiple tags when querying for services HOT 2
- Bump faraday requirement HOT 1
- Register HTTP checks HOT 3
- Add support for default datacenter HOT 3
- Broken link to API documentation HOT 3
- Register entities via agent
- Add blocking read support for service health endpoint HOT 3
- Faraday 2.0.0 breaks diplomat HOT 4
- Faraday 1.x can bypass Diplomat::QueryAlreadyExists HOT 1
- Can't get it to work with auth token given in config HOT 5
- Kv.put() method with Consul v1.10.1 results in KV entries that are visible via CLI/API, but not UI HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diplomat.