-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Consider supporting PUBSUB_EMULATOR_HOST #45
Comments
Is this something we could push to be supported upstream? |
It's worth a shot! Upstream I'd like to see more runtime config for the Tesla client. That's probably 90% of the difficulty right now. |
I opened up an issue a long time ago on Tesla exactly about the compile time config issues in Google APIs. Those issues have been addressed, so it may be a matter of updating Tesla and moving away from the compile time API. |
Ah, yes - and the Google API issue is still open: googleapis/elixir-google-api#98 :-) The Tesla version in latest is relatively up-to-date (v1.2); the problem right now is clients A function on the Connection (maybe For emulator support directly in the client, perhaps the (Edited to clarify needing to override base_url at runtime) |
Yeah, something along those lines. Maybe we should not make all new/* but rather have then build on top of a single build_client overridable one. FWIW, we can always force them to be overridable By calling defoverridable ourselves, but having both scenarios supported upstream would be nicer. :) |
This will at least allow you to use the emulator by configuring it in dev.exs, you could use this to pull from the env var.
|
Is there any progress on this? I've tried @michaelst's suggestion but it's not working for me - I can't see anywhere in the code that the base_url is read from Config |
I think that config workaround should work: The google_api_pub_sub connection setups the default base_url here: https://github.com/googleapis/elixir-google-api/blob/master/clients/pub_sub/lib/google_api/pub_sub/v1/connection.ex#L34 And Gax.Connection allow to override it with the configuration: |
Ok, more digging and looks like this is it: peburrows/goth#56 Goth still tried to get the token, but the config actually worked. Thanks for your help, but would be good if broadway could support this automatically. |
I'd love to see |
There's a lot of prior art for overriding authentication in the presence of an
PUBSUB_EMULATOR_HOST
environment variable. I'm opening this issue to get feedback on supporting it for the default GoogleApiClient implementation.Basically we'd look for the var at runtime, and when present, use its value as the base url and set a fake token generator.
This will need to be per-implementation, but we have
prepare_to_connect
on the Client behaviour for that.The only thing I'm not wild about is that the GoogleApiClient implementation would need to reach into the
:google_api_pub_sub
app config to override the base_url.Still, personally I'd like to see this implemented, as the required configuration steps are non-trivial, especially if you're coming from somewhere like the Python PubSub client, where you can just set an env var to use the emulator.
Original comment:
peburrows/goth#56 (comment)
/cc @matehat
The text was updated successfully, but these errors were encountered: