mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-28 11:46:20 -04:00
Merge branch 'majst01-make-tls-verify-optional'
* majst01-make-tls-verify-optional: Fix method signature Make tls verification optional
This commit is contained in:
commit
f2811e79e2
3 changed files with 11 additions and 4 deletions
6
main.go
6
main.go
|
@ -46,7 +46,7 @@ func preload(c *cli.Context) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the registry client
|
// 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,10 @@ func main() {
|
||||||
Name: "debug, d",
|
Name: "debug, d",
|
||||||
Usage: "run in debug mode",
|
Usage: "run in debug mode",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "skipverify, k",
|
||||||
|
Usage: "do not verify tls certificates",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "username, u",
|
Name: "username, u",
|
||||||
Usage: "username for the registry",
|
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.
|
// New creates a new Registry struct with the given URL and credentials.
|
||||||
func New(auth types.AuthConfig, debug bool) (*Registry, error) {
|
func New(auth types.AuthConfig, debug bool, skipverify bool) (*Registry, error) {
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport.(*http.Transport)
|
||||||
|
transport.TLSClientConfig = &tls.Config{
|
||||||
|
InsecureSkipVerify: skipverify,
|
||||||
|
}
|
||||||
|
|
||||||
return newFromTransport(auth, transport, debug)
|
return newFromTransport(auth, transport, debug)
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the registry client
|
// 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue