diff --git a/cli/command/cli.go b/cli/command/cli.go index aa90f15b3f..965c410ae9 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -598,7 +598,7 @@ type ServerInfo struct { // environment. func NewDockerCli(ops ...CLIOption) (*DockerCli, error) { defaultOps := []CLIOption{ - WithContentTrustFromEnv(), + withContentTrustFromEnv(), WithDefaultContextStoreConfig(), WithStandardStreams(), WithUserAgent(UserAgent()), diff --git a/cli/command/cli_options.go b/cli/command/cli_options.go index 87f8a2cc7d..4de7b2a8a0 100644 --- a/cli/command/cli_options.go +++ b/cli/command/cli_options.go @@ -76,8 +76,8 @@ func WithErrorStream(err io.Writer) CLIOption { } } -// WithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value. -func WithContentTrustFromEnv() CLIOption { +// withContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value. +func withContentTrustFromEnv() CLIOption { return func(cli *DockerCli) error { cli.contentTrust = false if e := os.Getenv("DOCKER_CONTENT_TRUST"); e != "" { @@ -90,7 +90,16 @@ func WithContentTrustFromEnv() CLIOption { } } +// WithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value. +// +// Deprecated: this option is no longer used, and will be removed in the next release. +func WithContentTrustFromEnv() CLIOption { + return withContentTrustFromEnv() +} + // WithContentTrust enables content trust on a cli. +// +// Deprecated: this option is no longer used, and will be removed in the next release. func WithContentTrust(enabled bool) CLIOption { return func(cli *DockerCli) error { cli.contentTrust = enabled diff --git a/cli/command/cli_options_test.go b/cli/command/cli_options_test.go index 45ac1d8a57..946a94df74 100644 --- a/cli/command/cli_options_test.go +++ b/cli/command/cli_options_test.go @@ -10,7 +10,7 @@ import ( func contentTrustEnabled(t *testing.T) bool { t.Helper() var cli DockerCli - assert.NilError(t, WithContentTrustFromEnv()(&cli)) + assert.NilError(t, withContentTrustFromEnv()(&cli)) return cli.contentTrust }