Skip to content

Commit 9c88b31

Browse files
authored
Merge pull request #6488 from thaJeztah/deprecate_dct_opts
cli/command: deprecate WithContentTrustFromEnv, WithContentTrust
2 parents 04bfe7d + 40cdfc0 commit 9c88b31

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

cli/command/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ type ServerInfo struct {
598598
// environment.
599599
func NewDockerCli(ops ...CLIOption) (*DockerCli, error) {
600600
defaultOps := []CLIOption{
601-
WithContentTrustFromEnv(),
601+
withContentTrustFromEnv(),
602602
WithDefaultContextStoreConfig(),
603603
WithStandardStreams(),
604604
WithUserAgent(UserAgent()),

cli/command/cli_options.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ func WithErrorStream(err io.Writer) CLIOption {
7676
}
7777
}
7878

79-
// WithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value.
80-
func WithContentTrustFromEnv() CLIOption {
79+
// withContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value.
80+
func withContentTrustFromEnv() CLIOption {
8181
return func(cli *DockerCli) error {
8282
cli.contentTrust = false
8383
if e := os.Getenv("DOCKER_CONTENT_TRUST"); e != "" {
@@ -90,7 +90,16 @@ func WithContentTrustFromEnv() CLIOption {
9090
}
9191
}
9292

93+
// WithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value.
94+
//
95+
// Deprecated: this option is no longer used, and will be removed in the next release.
96+
func WithContentTrustFromEnv() CLIOption {
97+
return withContentTrustFromEnv()
98+
}
99+
93100
// WithContentTrust enables content trust on a cli.
101+
//
102+
// Deprecated: this option is no longer used, and will be removed in the next release.
94103
func WithContentTrust(enabled bool) CLIOption {
95104
return func(cli *DockerCli) error {
96105
cli.contentTrust = enabled

cli/command/cli_options_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func contentTrustEnabled(t *testing.T) bool {
1111
t.Helper()
1212
var cli DockerCli
13-
assert.NilError(t, WithContentTrustFromEnv()(&cli))
13+
assert.NilError(t, withContentTrustFromEnv()(&cli))
1414
return cli.contentTrust
1515
}
1616

0 commit comments

Comments
 (0)