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

Configurable endpoint #36

Open
blogle opened this issue Feb 4, 2021 · 4 comments
Open

Configurable endpoint #36

blogle opened this issue Feb 4, 2021 · 4 comments
Assignees
Labels
C-enhancement Category: Enhancement P-medium Priority: Medium

Comments

@blogle
Copy link

blogle commented Feb 4, 2021

Currently much of the uris are built from hard-coded associated constants in the Client struct. it would be great if the Client::Endpoint was configurable (or overridable by STORAGE_EMULATOR_HOST) so users could program against a test server as demonstrated in this project https://github.com/fsouza/fake-gcs-server/tree/main/examples

it would appear that others are interested in this functionality (see: pingcap/br#258)
and they have investigated crudely swapping out the uri from tame_gcs in the tikv gcs backend

@Hirevo
Copy link
Member

Hirevo commented Mar 24, 2021

Hello !

Sorry for my long absence.
This seems straightforward to implement, if it suffices to add a constructor to allow passing a custom endpoint to the Client types.
One question though is does this require to implement authentication differently than for normal GCP ?
From what I can see, the particular emulator works over plain-text HTTP and without authentication, if I understood correctly ?
If so, we would need a way to kinda 'disable' authentication as well, I guess.

@Hirevo Hirevo self-assigned this Mar 24, 2021
@Hirevo Hirevo added C-enhancement Category: Enhancement P-medium Priority: Medium labels Mar 24, 2021
@Roba1993
Copy link

@blogle I had the same requirement as you. I looked into this topic and decided for myself to go down a different route.
Instead of usinf the fake-gcs-server I created the following library https://github.com/Roba1993/stow/actions
With this library you can store the files locally or on the GCP based upon the inital config.

@blogle
Copy link
Author

blogle commented Apr 12, 2021

Hello !

Sorry for my long absence.
This seems straightforward to implement, if it suffices to add a constructor to allow passing a custom endpoint to the Client types.
One question though is does this require to implement authentication differently than for normal GCP ?
From what I can see, the particular emulator works over plain-text HTTP and without authentication, if I understood correctly ?
If so, we would need a way to kinda 'disable' authentication as well, I guess.

Yeah looking at the different client examples on the fake-gcs-server repo, they either configure the client endpoint (see https://github.com/fsouza/fake-gcs-server/blob/main/examples/go/main.go#L27) or instantiate the client using AnonymousCredentials. As you mention I believe auth would likely need to be disabled when hitting the local/test server.

@Tarkin25
Copy link

Tarkin25 commented Feb 8, 2022

@Hirevo

Hello !

Sorry for my long absence. This seems straightforward to implement, if it suffices to add a constructor to allow passing a custom endpoint to the Client types. One question though is does this require to implement authentication differently than for normal GCP ? From what I can see, the particular emulator works over plain-text HTTP and without authentication, if I understood correctly ? If so, we would need a way to kinda 'disable' authentication as well, I guess.

I have looked at the code of the cloud-pubsub crate, and from what I saw, there is no need to disable authentication. I did only test it for the pubsub emulator, not for any of the other ones.

Simply configuring the endpoint URL to the local emulator endpoint might just work as seen here:
https://github.com/kayleg/cloud-pubsub/blob/master/src/subscription.rs

Tarkin25 added a commit to Tarkin25/google-cloud-rs that referenced this issue Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement P-medium Priority: Medium
Projects
None yet
Development

No branches or pull requests

4 participants