Implement WithDefaultContextStoreConfig() DockerCliOption
Just a minor refactor to make this slightly cleaner Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
d35b50c0c3
commit
cc08fc1af0
@ -422,12 +422,13 @@ type ClientInfo struct {
|
|||||||
// It applies by default the standard streams, and the content trust from
|
// It applies by default the standard streams, and the content trust from
|
||||||
// environment.
|
// environment.
|
||||||
func NewDockerCli(ops ...DockerCliOption) (*DockerCli, error) {
|
func NewDockerCli(ops ...DockerCliOption) (*DockerCli, error) {
|
||||||
cli := &DockerCli{}
|
|
||||||
defaultOps := []DockerCliOption{
|
defaultOps := []DockerCliOption{
|
||||||
WithContentTrustFromEnv(),
|
WithContentTrustFromEnv(),
|
||||||
|
WithDefaultContextStoreConfig(),
|
||||||
}
|
}
|
||||||
cli.contextStoreConfig = DefaultContextStoreConfig()
|
|
||||||
ops = append(defaultOps, ops...)
|
ops = append(defaultOps, ops...)
|
||||||
|
|
||||||
|
cli := &DockerCli{}
|
||||||
if err := cli.Apply(ops...); err != nil {
|
if err := cli.Apply(ops...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -94,3 +94,11 @@ func WithContextEndpointType(endpointName string, endpointType store.TypeGetter)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithDefaultContextStoreConfig configures the cli to use the default context store configuration.
|
||||||
|
func WithDefaultContextStoreConfig() DockerCliOption {
|
||||||
|
return func(cli *DockerCli) error {
|
||||||
|
cli.contextStoreConfig = DefaultContextStoreConfig()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user