From 83f67c63a64b4088f5c53c781fb5734c37fc3bf8 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 23 Apr 2022 14:17:51 +0200 Subject: [PATCH] cmd/dockerd: combine installRegistryServiceFlags with installCommonConfigFlags There's no compelling reason to keep it in a separate function Signed-off-by: Sebastiaan van Stijn --- cmd/dockerd/config.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/cmd/dockerd/config.go b/cmd/dockerd/config.go index a9b9869142..8c2578339f 100644 --- a/cmd/dockerd/config.go +++ b/cmd/dockerd/config.go @@ -27,7 +27,14 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error { return err } - installRegistryServiceFlags(&conf.ServiceOptions, flags) + var ( + allowNonDistributable = opts.NewNamedListOptsRef("allow-nondistributable-artifacts", &conf.AllowNondistributableArtifacts, registry.ValidateIndexName) + registryMirrors = opts.NewNamedListOptsRef("registry-mirrors", &conf.Mirrors, registry.ValidateMirror) + insecureRegistries = opts.NewNamedListOptsRef("insecure-registries", &conf.InsecureRegistries, registry.ValidateIndexName) + ) + flags.Var(allowNonDistributable, "allow-nondistributable-artifacts", "Allow push of nondistributable artifacts to registry") + flags.Var(registryMirrors, "registry-mirror", "Preferred Docker registry mirror") + flags.Var(insecureRegistries, "insecure-registry", "Enable insecure registry communication") flags.Var(opts.NewNamedListOptsRef("storage-opts", &conf.GraphOptions, nil), "storage-opt", "Storage driver options") flags.Var(opts.NewNamedListOptsRef("authorization-plugins", &conf.AuthorizationPlugins, nil), "authorization-plugin", "Authorization plugins to load") @@ -92,13 +99,3 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error { return nil } - -func installRegistryServiceFlags(options *registry.ServiceOptions, flags *pflag.FlagSet) { - ana := opts.NewNamedListOptsRef("allow-nondistributable-artifacts", &options.AllowNondistributableArtifacts, registry.ValidateIndexName) - mirrors := opts.NewNamedListOptsRef("registry-mirrors", &options.Mirrors, registry.ValidateMirror) - insecureRegistries := opts.NewNamedListOptsRef("insecure-registries", &options.InsecureRegistries, registry.ValidateIndexName) - - flags.Var(ana, "allow-nondistributable-artifacts", "Allow push of nondistributable artifacts to registry") - flags.Var(mirrors, "registry-mirror", "Preferred Docker registry mirror") - flags.Var(insecureRegistries, "insecure-registry", "Enable insecure registry communication") -}