0
0
mirror of https://github.com/thegeeklab/wp-plugin-go.git synced 2024-06-02 18:39:40 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
8ad911886e
fix: print version with newline (#70) 2024-05-04 15:50:28 +02:00
fc2102453c
bump module major version 2024-05-04 14:13:52 +02:00
f381a5e6ba
fix: rename SkipVerify to InsecureSkipVerify (#69)
BREAKING CHANGE: The struct field `Network.SkipVerify` was renamed to `Network.InsecureSkipVerify`.
2024-05-04 13:55:56 +02:00
4 changed files with 14 additions and 14 deletions

View File

@ -9,7 +9,7 @@ import (
"sort" "sort"
"strings" "strings"
wp_template "github.com/thegeeklab/wp-plugin-go/template" wp_template "github.com/thegeeklab/wp-plugin-go/v2/template"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/thegeeklab/wp-plugin-go module github.com/thegeeklab/wp-plugin-go/v2
go 1.22 go 1.22

View File

@ -24,7 +24,7 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/thegeeklab/wp-plugin-go/trace" "github.com/thegeeklab/wp-plugin-go/v2/trace"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"golang.org/x/net/proxy" "golang.org/x/net/proxy"
) )
@ -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{
@ -134,8 +134,8 @@ func NetworkFromContext(ctx *cli.Context) Network {
} }
return Network{ return Network{
Context: defaultContext, Context: defaultContext,
SkipVerify: skip, InsecureSkipVerify: skipVerify,
Client: client, Client: client,
} }
} }

View File

@ -111,7 +111,7 @@ func New(opt Options) *Plugin {
cli.VersionPrinter = func(c *cli.Context) { cli.VersionPrinter = func(c *cli.Context) {
version := fmt.Sprintf("%s version=%s %s\n", c.App.Name, c.App.Version, opt.VersionMetadata) version := fmt.Sprintf("%s version=%s %s\n", c.App.Name, c.App.Version, opt.VersionMetadata)
fmt.Print(strings.TrimSpace(version)) fmt.Println(strings.TrimSpace(version))
} }
plugin := &Plugin{ plugin := &Plugin{