From 8094f50dd0fafa9695457ee9bf3dfd8f3a19bf26 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Fri, 24 Dec 2021 14:25:59 +0900 Subject: [PATCH] remotes/docker/config: allow setting custom AuthorizerOpts Signed-off-by: Akihiro Suda --- remotes/docker/config/hosts.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/remotes/docker/config/hosts.go b/remotes/docker/config/hosts.go index 61cdea45f..f47e4ec06 100644 --- a/remotes/docker/config/hosts.go +++ b/remotes/docker/config/hosts.go @@ -63,7 +63,8 @@ type HostOptions struct { DefaultTLS *tls.Config DefaultScheme string // UpdateClient will be called after creating http.Client object, so clients can provide extra configuration - UpdateClient UpdateClientFunc + UpdateClient UpdateClientFunc + AuthorizerOpts []docker.AuthorizerOpt } // ConfigureHosts creates a registry hosts function from the provided @@ -143,6 +144,7 @@ func ConfigureHosts(ctx context.Context, options HostOptions) docker.RegistryHos if options.Credentials != nil { authOpts = append(authOpts, docker.WithAuthCreds(options.Credentials)) } + authOpts = append(authOpts, options.AuthorizerOpts...) authorizer := docker.NewDockerAuthorizer(authOpts...) rhosts := make([]docker.RegistryHost, len(hosts))