camallo / dkregistry-rs

A pure-Rust asynchronous library for Docker Registry API v2
Apache License 2.0
62 stars 39 forks source link

allow users to specify a prebuilt reqwest client #203

Open tofay opened 3 years ago

tofay commented 3 years ago

if specified this will be used instead of dkregistry creating one.

This makes it easier to use non-standard authentication mechanisms:

(In the latter case users login using az tool which writes an oauth2 token to the identitytoken field of the relevant auth section of $HOME/.docker/config.json. When communicating with the registry that token can just be provided by adding the header Authentication: Bearer <token> )

tofay commented 3 years ago

In both my use cases I want to build a reqwest client that adds a specific header, so maybe I should be allowing users to specify additional headers instead, to avoid putting reqwest::Client into dkregistry's public API? (I think the use of reqwest is an implementation detail right now)

vrutkovs commented 2 years ago

maybe I should be allowing users to specify additional headers instead

Yeah, I think that would be more flexible and avoid possible API issues. IIUC https://github.com/camallo/dkregistry-rs/pull/212 is implementing that