mirror of
https://github.com/thegeeklab/drone-plugin-lib.git
synced 2024-11-22 21:00:40 +00:00
Expose whether SSL verification is skipped
This commit is contained in:
parent
8fb8284d71
commit
b771a2a224
@ -30,6 +30,9 @@ type Network struct {
|
|||||||
|
|
||||||
// Client for making network requests.
|
// Client for making network requests.
|
||||||
Client *http.Client
|
Client *http.Client
|
||||||
|
|
||||||
|
/// Whether SSL verification is skipped
|
||||||
|
SkipVerify bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const networkSkipVerifyFlag = "transport.skip-verify"
|
const networkSkipVerifyFlag = "transport.skip-verify"
|
||||||
@ -61,7 +64,8 @@ func NetworkFromContext(ctx *cli.Context) Network {
|
|||||||
ExpectContinueTimeout: 1 * time.Second,
|
ExpectContinueTimeout: 1 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Bool(networkSkipVerifyFlag) {
|
skipVerify := ctx.Bool(networkSkipVerifyFlag)
|
||||||
|
if skipVerify {
|
||||||
logrus.Warning("ssl verification is turned off")
|
logrus.Warning("ssl verification is turned off")
|
||||||
transport.TLSClientConfig = &tls.Config{
|
transport.TLSClientConfig = &tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
@ -79,6 +83,7 @@ func NetworkFromContext(ctx *cli.Context) Network {
|
|||||||
Client: &http.Client{
|
Client: &http.Client{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
},
|
},
|
||||||
Context: context,
|
Context: context,
|
||||||
|
SkipVerify: skipVerify,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user