/
options.go
41 lines (34 loc) · 845 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package cr
import "github.com/google/go-containerregistry/pkg/authn"
type registryOptions struct {
ca string
useHTTP bool
withoutAuth bool
useDigest bool
authKeyChain authn.Keychain
}
type Option func(options *registryOptions)
// WithCA use custom CA certificate
func WithCA(ca string) Option {
return func(options *registryOptions) {
options.ca = ca
}
}
// WithInsecureSchema use http schema instead of https
func WithInsecureSchema() Option {
return func(options *registryOptions) {
options.useHTTP = true
}
}
// WithDisabledAuth don't use authConfig
func WithDisabledAuth() Option {
return func(options *registryOptions) {
options.withoutAuth = true
}
}
// WithUseDigest use digest except of tag
func WithUseDigest() Option {
return func(options *registryOptions) {
options.useDigest = true
}
}