0
0
mirror of https://github.com/thegeeklab/wp-plugin-go.git synced 2024-11-22 00:20:38 +00:00

Expose whether SSL verification is skipped

This commit is contained in:
Don 2019-12-18 15:37:07 -08:00
parent 8fb8284d71
commit b771a2a224

View File

@ -30,6 +30,9 @@ type Network struct {
// Client for making network requests.
Client *http.Client
/// Whether SSL verification is skipped
SkipVerify bool
}
const networkSkipVerifyFlag = "transport.skip-verify"
@ -61,7 +64,8 @@ func NetworkFromContext(ctx *cli.Context) Network {
ExpectContinueTimeout: 1 * time.Second,
}
if ctx.Bool(networkSkipVerifyFlag) {
skipVerify := ctx.Bool(networkSkipVerifyFlag)
if skipVerify {
logrus.Warning("ssl verification is turned off")
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
@ -79,6 +83,7 @@ func NetworkFromContext(ctx *cli.Context) Network {
Client: &http.Client{
Transport: transport,
},
Context: context,
Context: context,
SkipVerify: skipVerify,
}
}