container/client: rework tls settings
Instead of having an extra field, `TlsVerify`, on the `Client` and then later setting the corresponding `SystemContext` options, use the existing `SystemContext` field of `Client`. The corresponding field is a tri-state: unset, true, false, which is represented as a pointer to boolean in the `Client`'s new getter and setter. This also inverts the boolean logic from verify TLS to skip TLS which aligns very well with the corresponding fields in the upload target struct. In addition we properly capitalize some existing variables.
This commit is contained in:
parent
4b67e12958
commit
865a899f70
3 changed files with 36 additions and 10 deletions
|
|
@ -17,14 +17,14 @@ func main() {
|
|||
var username string
|
||||
var password string
|
||||
var tag string
|
||||
var ignoreTls bool
|
||||
var ignoreTLS bool
|
||||
|
||||
flag.StringVar(&filename, "container", "", "path to the oci-archive to upload (required)")
|
||||
flag.StringVar(&destination, "destination", "", "destination to upload to (required)")
|
||||
flag.StringVar(&tag, "tag", "", "destination tag to use for the container")
|
||||
flag.StringVar(&username, "username", "", "username to use for registry")
|
||||
flag.StringVar(&password, "password", "", "password to use for registry")
|
||||
flag.BoolVar(&ignoreTls, "ignore-tls", false, "ignore tls verification for destination")
|
||||
flag.BoolVar(&ignoreTLS, "ignore-tls", false, "ignore tls verification for destination")
|
||||
flag.Parse()
|
||||
|
||||
if filename == "" || destination == "" {
|
||||
|
|
@ -59,7 +59,9 @@ func main() {
|
|||
client.SetCredentials(username, password)
|
||||
}
|
||||
|
||||
client.TlsVerify = !ignoreTls
|
||||
if ignoreTLS {
|
||||
client.SkipTLSVerify()
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue