registry: use lazyregexp to compile regexes on first use

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-07-15 16:29:23 +02:00
parent b6b19059c5
commit b5d90d746b

View File

@@ -4,13 +4,13 @@ import (
"context"
"net"
"net/url"
"regexp"
"strconv"
"strings"
"github.com/containerd/log"
"github.com/distribution/reference"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/internal/lazyregexp"
)
// ServiceOptions holds command line options.
@@ -57,7 +57,7 @@ var (
}
emptyServiceConfig, _ = newServiceConfig(ServiceOptions{})
validHostPortRegex = regexp.MustCompile(`^` + reference.DomainRegexp.String() + `$`)
validHostPortRegex = lazyregexp.New(`^` + reference.DomainRegexp.String() + `$`)
// certsDir is used to override defaultCertsDir.
certsDir string