Skip to content

Commit 4665091

Browse files
committed
cli/command: deprecate WithContentTrustFromEnv, WithContentTrust
These options were used internally as defaults for the constructor and only impact commands implemented in the CLI itself. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 40cdfc0) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 3755161 commit 4665091

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
@@ -75,8 +75,8 @@ func WithErrorStream(err io.Writer) CLIOption {
7575
}
7676
}
7777

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

92+
// WithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value.
93+
//
94+
// Deprecated: this option is no longer used, and will be removed in the next release.
95+
func WithContentTrustFromEnv() CLIOption {
96+
return withContentTrustFromEnv()
97+
}
98+
9299
// WithContentTrust enables content trust on a cli.
100+
//
101+
// Deprecated: this option is no longer used, and will be removed in the next release.
93102
func WithContentTrust(enabled bool) CLIOption {
94103
return func(cli *DockerCli) error {
95104
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)