Skip to content
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

Added the possibility to set a proxy URL for the client #103

Merged
merged 6 commits into from
Feb 11, 2019

Conversation

EtienneDepaulis
Copy link
Contributor

This PR adds an attribute proxy_url to the FHIR::Client object. It helps set up a proxy URL.

For the RestClient strategy, it was possible to define it after setting the strategy, for the OAuth2::Client it was needed inside in order to provide this configuration before retrieving the token.

@arscan
Copy link
Member

arscan commented Sep 28, 2018

Thanks for another contribution!

We have been simply using the http_proxy and https_proxy environment variables to handle proxies, which get picked up by the libraries we are using. Is there a situation where this doesn't work?

@EtienneDepaulis
Copy link
Contributor Author

Not a bad idea, I completely forgot about this feature :/ Thx for pointing it out :)

@EtienneDepaulis
Copy link
Contributor Author

@arscan We identified an issue using the HTTPS_PROXY setting on Heroku : it looks like it is used during build time which prevents the app from being deployed :/
Therefore I would like to re-submit this PR as it can help avoid this kind of conflict on certain PaaS

@arscan
Copy link
Member

arscan commented Nov 1, 2018

Sure, since both RestClient and OAuthClient have a proxy attribute, it seems to make sense for this library to also. Would you consider naming it proxy just to be consistent with those other two libraries we use?

And I just accepted PR #105, which creates a new client to resolve external references. I assume we should have that client use the same proxy as this client. Could you pull in those changes here (or rebase) and add in this proxy to that?

And finally, could you update the README with a quick blurb about this (just near the end is fine).

Thanks!

@EtienneDepaulis
Copy link
Contributor Author

@arscan I've updated the naming convention in favor of proxy and added basic info in the Readme (I also included the additional_headers which was missing in the documentation).

As for #105 I'm not certain about how to tackle this problem. What about other settings ?

@arscan
Copy link
Member

arscan commented Nov 2, 2018

Thanks! I think you forgot to rename proxy_url to proxy in a few places though, since a bunch of tests are failing now.

And I was just referring to these two lines:
https://github.com/fhir-crucible/fhir_client/blob/master/lib/fhir_client/ext/reference.rb#L62
https://github.com/fhir-crucible/fhir_client/blob/master/lib/fhir_client/ext/reference.rb#L72

To follow external references we have to create a new client (because it is a new FHIR endpoint), and I would think we would want to set the proxy correctly on those new clients, or is that not necessary given the way that RestClient is referenced?

Also, I'm a bit confused about how this is used. It doesn't seem like the proxy is set until you explicitly set an auth scheme (or set_no_auth)? Just doing client.proxy = 'http:https://xyz.com' won't propagate the change to RestClient or OAuthClient, until something like client.set_no_auth is called?

@EtienneDepaulis
Copy link
Contributor Author

@arscan I fixed the typo, wrong copy/paste I guess :/

My PR only worked for authenticated clients. I changed this behavior and added a param on the initialize method and also updated the 2 clients mentioned in your previous comment.

However, I was wondering how the external approach works for authenticated clients as only the basic params are passed on.

@radamson
Copy link
Contributor

Thanks for the contribution and updates!

@radamson radamson merged commit 772e090 into fhir-crucible:master Feb 11, 2019
@EtienneDepaulis
Copy link
Contributor Author

Thx @radamson :)

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.

None yet

3 participants