Get config more directly
This commit is contained in:
@@ -48,6 +48,7 @@ var _indexExamples string
|
||||
// Index is an OCI index or manifest list on a remote registry.
|
||||
type Index struct {
|
||||
docker Client
|
||||
config *Config
|
||||
}
|
||||
|
||||
// IndexArgs instantiate an Index.
|
||||
@@ -349,7 +350,7 @@ func (i *Index) Diff(
|
||||
// client produces a CLI client scoped to this resource and layered on top of
|
||||
// any host-level credentials.
|
||||
func (i *Index) client(
|
||||
ctx context.Context,
|
||||
_ context.Context,
|
||||
_ IndexState,
|
||||
args IndexArgs,
|
||||
) (Client, error) {
|
||||
@@ -358,16 +359,14 @@ func (i *Index) client(
|
||||
return i.docker, nil
|
||||
}
|
||||
|
||||
cfg := infer.GetConfig[Config](ctx)
|
||||
|
||||
// We prefer auth from args, the provider, and state in that order. We
|
||||
// build a slice in reverse order because wrap() will overwrite earlier
|
||||
// entries with later ones.
|
||||
auths := []Registry{}
|
||||
auths = append(auths, cfg.Registries...)
|
||||
auths = append(auths, i.config.Registries...)
|
||||
if args.Registry != nil {
|
||||
auths = append(auths, *args.Registry)
|
||||
}
|
||||
|
||||
return wrap(cfg.host, auths...)
|
||||
return wrap(i.config.host, auths...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user