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

fix: rename SkipVerify to InsecureSkipVerify (#69)

BREAKING CHANGE: The struct field `Network.SkipVerify` was renamed to `Network.InsecureSkipVerify`.
This commit is contained in:
Robert Kaussow 2024-05-04 13:55:56 +02:00 committed by GitHub
parent 35072e3425
commit f381a5e6ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,8 +45,8 @@ type Network struct {
//nolint:containedctx //nolint:containedctx
Context context.Context Context context.Context
/// Whether SSL verification is skipped /// Whether SSL verification is skipped or not.
SkipVerify bool InsecureSkipVerify bool
// Client for making network requests. // Client for making network requests.
Client *http.Client Client *http.Client
@ -55,9 +55,9 @@ type Network struct {
func networkFlags(category string) []cli.Flag { func networkFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "transport.skip-verify", Name: "transport.insecure-skip-verify",
Usage: "skip ssl verify", Usage: "skip SSL verification",
EnvVars: []string{"PLUGIN_SKIP_VERIFY"}, EnvVars: []string{"PLUGIN_INSECURE_SKIP_VERIFY"},
Category: category, Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
@ -77,7 +77,7 @@ func networkFlags(category string) []cli.Flag {
func NetworkFromContext(ctx *cli.Context) Network { func NetworkFromContext(ctx *cli.Context) Network {
var ( var (
skip = ctx.Bool("transport.skip-verify") skipVerify = ctx.Bool("transport.insecure-skip-verify")
defaultContext = context.Background() defaultContext = context.Background()
socks = ctx.String("transport.socks-proxy") socks = ctx.String("transport.socks-proxy")
socksoff = ctx.Bool("transport.socks-proxy-off") socksoff = ctx.Bool("transport.socks-proxy-off")
@ -90,7 +90,7 @@ func NetworkFromContext(ctx *cli.Context) Network {
tlsConfig := &tls.Config{ tlsConfig := &tls.Config{
RootCAs: certs, RootCAs: certs,
InsecureSkipVerify: skip, //nolint:gosec InsecureSkipVerify: skipVerify, //nolint:gosec
} }
transport := &http.Transport{ transport := &http.Transport{
@ -135,7 +135,7 @@ func NetworkFromContext(ctx *cli.Context) Network {
return Network{ return Network{
Context: defaultContext, Context: defaultContext,
SkipVerify: skip, InsecureSkipVerify: skipVerify,
Client: client, Client: client,
} }
} }