ThouCheese / cloud-storage-rs

A crate for uploading files to Google cloud storage, and for generating download urls.
MIT License
123 stars 88 forks source link

Allow usage w/ an emulator #96

Open crepererum opened 2 years ago

crepererum commented 2 years ago

It would be nice if cloud-storage would allow users to connect to an emulator like https://github.com/oittaa/gcp-storage-emulator or https://github.com/fsouza/fake-gcs-server for local testing. For this the following behavior changes are required:

  1. Disable auth. Other libs call this AnonymousCredentials, but I think it's just that they don't specify any auth headers at all (ref).
  2. Allow to specify a custom endpoint instead of a hardcoded BASE_URL.
ThouCheese commented 2 years ago

Sure this is something that we can do. Do you have a specific API in mind that works well for you? Maybe something like

cloud_storage::Client::new()
    .disable_auth()
    .base_url("whatever")
    // rest of your behaviour

Would that work/be convenient?

crepererum commented 2 years ago

The proposed API looks perfect. 👍