mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-28 11:46:20 -04:00
Make tls verification optional
This commit is contained in:
parent
b427cc03ae
commit
89031c4ab0
2 changed files with 10 additions and 3 deletions
6
main.go
6
main.go
|
@ -46,7 +46,7 @@ func preload(c *cli.Context) (err error) {
|
|||
}
|
||||
|
||||
// create the registry client
|
||||
r, err = registry.New(auth, c.GlobalBool("debug"))
|
||||
r, err = registry.New(auth, c.GlobalBool("debug"), c.GlobalBool("skipverify"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -69,6 +69,10 @@ func main() {
|
|||
Name: "debug, d",
|
||||
Usage: "run in debug mode",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "skipverify, k",
|
||||
Usage: "do not verify tls certificates",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "username, u",
|
||||
Usage: "username for the registry",
|
||||
|
|
|
@ -33,8 +33,11 @@ func Log(format string, args ...interface{}) {
|
|||
}
|
||||
|
||||
// New creates a new Registry struct with the given URL and credentials.
|
||||
func New(auth types.AuthConfig, debug bool) (*Registry, error) {
|
||||
transport := http.DefaultTransport
|
||||
func New(auth types.AuthConfig, debug bool, skipverify bool) (*Registry, error) {
|
||||
transport := http.DefaultTransport.(*http.Transport)
|
||||
transport.TLSClientConfig = &tls.Config{
|
||||
InsecureSkipVerify: skipverify,
|
||||
}
|
||||
|
||||
return newFromTransport(auth, transport, debug)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue