registry: use consts for some defaults

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-11-05 12:40:28 +01:00
parent e3509fc1de
commit f1dff3e434
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -72,15 +72,16 @@ var defaultCipherSuites = []uint16{
tls.TLS_AES_256_GCM_SHA384, tls.TLS_AES_256_GCM_SHA384,
} }
// maps tls version strings to constants const defaultTLSVersionStr = "tls1.2"
var (
defaultTLSVersionStr = "tls1.2" // tlsVersions maps user-specified values to tls version constants.
tlsVersions = map[string]uint16{ var tlsVersions = map[string]uint16{
// user specified values "tls1.2": tls.VersionTLS12,
"tls1.2": tls.VersionTLS12, "tls1.3": tls.VersionTLS13,
"tls1.3": tls.VersionTLS13, }
}
) // defaultLogFormatter is the default formatter to use for logs.
const defaultLogFormatter = "text"
// this channel gets notified when process receives signal. It is global to ease unit testing // this channel gets notified when process receives signal. It is global to ease unit testing
var quit = make(chan os.Signal, 1) var quit = make(chan os.Signal, 1)
@ -131,6 +132,7 @@ var ServeCmd = &cobra.Command{
} }
// A Registry represents a complete instance of the registry. // A Registry represents a complete instance of the registry.
//
// TODO(aaronl): It might make sense for Registry to become an interface. // TODO(aaronl): It might make sense for Registry to become an interface.
type Registry struct { type Registry struct {
config *configuration.Configuration config *configuration.Configuration
@ -347,7 +349,7 @@ func configureLogging(ctx context.Context, config *configuration.Configuration)
formatter := config.Log.Formatter formatter := config.Log.Formatter
if formatter == "" { if formatter == "" {
formatter = "text" // default formatter formatter = defaultLogFormatter
} }
switch formatter { switch formatter {