1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

registry: use consts for default registry

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-10-28 11:10:32 +01:00
parent a66aa12f69
commit ab47fd2f72
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -26,7 +26,7 @@ type serviceConfig struct {
registrytypes.ServiceConfig registrytypes.ServiceConfig
} }
var ( const (
// DefaultNamespace is the default namespace // DefaultNamespace is the default namespace
DefaultNamespace = "docker.io" DefaultNamespace = "docker.io"
// DefaultRegistryVersionHeader is the name of the default HTTP header // DefaultRegistryVersionHeader is the name of the default HTTP header
@ -39,28 +39,25 @@ var (
IndexServer = "https://" + IndexHostname + "/v1/" IndexServer = "https://" + IndexHostname + "/v1/"
// IndexName is the name of the index // IndexName is the name of the index
IndexName = "docker.io" IndexName = "docker.io"
)
var (
// DefaultV2Registry is the URI of the default v2 registry // DefaultV2Registry is the URI of the default v2 registry
DefaultV2Registry = &url.URL{ DefaultV2Registry = &url.URL{
Scheme: "https", Scheme: "https",
Host: "registry-1.docker.io", Host: "registry-1.docker.io",
} }
)
var (
// ErrInvalidRepositoryName is an error returned if the repository name did // ErrInvalidRepositoryName is an error returned if the repository name did
// not have the correct form // not have the correct form
ErrInvalidRepositoryName = errors.New("Invalid repository name (ex: \"registry.domain.tld/myrepos\")") ErrInvalidRepositoryName = errors.New("Invalid repository name (ex: \"registry.domain.tld/myrepos\")")
emptyServiceConfig, _ = newServiceConfig(ServiceOptions{}) emptyServiceConfig, _ = newServiceConfig(ServiceOptions{})
)
var (
validHostPortRegex = regexp.MustCompile(`^` + reference.DomainRegexp.String() + `$`) validHostPortRegex = regexp.MustCompile(`^` + reference.DomainRegexp.String() + `$`)
)
// for mocking in unit tests // for mocking in unit tests
var lookupIP = net.LookupIP lookupIP = net.LookupIP
)
// newServiceConfig returns a new instance of ServiceConfig // newServiceConfig returns a new instance of ServiceConfig
func newServiceConfig(options ServiceOptions) (*serviceConfig, error) { func newServiceConfig(options ServiceOptions) (*serviceConfig, error) {