Skip to content

Commit d0442ed

Browse files
authored
Merge pull request #6845 from thaJeztah/cleanup_godoc
cli/config/credentials: ConvertToHostname: update godoc
2 parents 3897d9c + eef3c95 commit d0442ed

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

cli/config/credentials/file_store.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,14 @@ func (c *fileStore) Store(authConfig types.AuthConfig) error {
9999
return nil
100100
}
101101

102-
// ConvertToHostname converts a registry url which has http|https prepended
103-
// to just an hostname.
104-
// Copied from github.com/docker/docker/registry.ConvertToHostname to reduce dependencies.
102+
// ConvertToHostname normalizes a registry URL which has http|https prepended
103+
// to just its hostname. It is used to match credentials, which may be either
104+
// stored as hostname or as hostname including scheme (in legacy configuration
105+
// files).
106+
//
107+
// It's the equivalent to [registry.ConvertToHostname] in the daemon.
108+
//
109+
// [registry.ConvertToHostname]: https://pkg.go.dev/github.com/moby/moby/v2@v2.0.0-beta.7/daemon/pkg/registry#ConvertToHostname
105110
func ConvertToHostname(maybeURL string) string {
106111
stripped := maybeURL
107112
if strings.Contains(stripped, "://") {

0 commit comments

Comments
 (0)