mirror of
https://github.com/ko-build/ko.git
synced 2025-02-07 19:30:23 +02:00
Make --insecure-registry work with TLS registries whose certs we can't verify. (#398)
* Make --insecure-registry work with TLS registries whose certs we can't verify. * Don't error if we can't disable TLS checking when insecure.
This commit is contained in:
parent
18096666c9
commit
f04730dc84
@ -15,6 +15,7 @@
|
||||
package publish
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"log"
|
||||
"net/http"
|
||||
"path"
|
||||
@ -105,6 +106,17 @@ func WithTagOnly(tagOnly bool) Option {
|
||||
func Insecure(b bool) Option {
|
||||
return func(i *defaultOpener) error {
|
||||
i.insecure = b
|
||||
t, ok := i.t.(*http.Transport)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
t = t.Clone()
|
||||
if t.TLSClientConfig == nil {
|
||||
t.TLSClientConfig = &tls.Config{} //nolint: gosec
|
||||
}
|
||||
t.TLSClientConfig.InsecureSkipVerify = b //nolint: gosec
|
||||
i.t = t
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user