Compare commits
3 Commits
35072e3425
...
8ad911886e
Author | SHA1 | Date |
---|---|---|
Robert Kaussow | 8ad911886e | |
Robert Kaussow | fc2102453c | |
Robert Kaussow | f381a5e6ba |
|
@ -9,7 +9,7 @@ import (
|
|||
"sort"
|
||||
"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"
|
||||
)
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module github.com/thegeeklab/wp-plugin-go
|
||||
module github.com/thegeeklab/wp-plugin-go/v2
|
||||
|
||||
go 1.22
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
|
||||
"github.com/rs/zerolog"
|
||||
"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"
|
||||
"golang.org/x/net/proxy"
|
||||
)
|
||||
|
@ -45,8 +45,8 @@ type Network struct {
|
|||
//nolint:containedctx
|
||||
Context context.Context
|
||||
|
||||
/// Whether SSL verification is skipped
|
||||
SkipVerify bool
|
||||
/// Whether SSL verification is skipped or not.
|
||||
InsecureSkipVerify bool
|
||||
|
||||
// Client for making network requests.
|
||||
Client *http.Client
|
||||
|
@ -55,9 +55,9 @@ type Network struct {
|
|||
func networkFlags(category string) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "transport.skip-verify",
|
||||
Usage: "skip ssl verify",
|
||||
EnvVars: []string{"PLUGIN_SKIP_VERIFY"},
|
||||
Name: "transport.insecure-skip-verify",
|
||||
Usage: "skip SSL verification",
|
||||
EnvVars: []string{"PLUGIN_INSECURE_SKIP_VERIFY"},
|
||||
Category: category,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
|
@ -77,7 +77,7 @@ func networkFlags(category string) []cli.Flag {
|
|||
|
||||
func NetworkFromContext(ctx *cli.Context) Network {
|
||||
var (
|
||||
skip = ctx.Bool("transport.skip-verify")
|
||||
skipVerify = ctx.Bool("transport.insecure-skip-verify")
|
||||
defaultContext = context.Background()
|
||||
socks = ctx.String("transport.socks-proxy")
|
||||
socksoff = ctx.Bool("transport.socks-proxy-off")
|
||||
|
@ -90,7 +90,7 @@ func NetworkFromContext(ctx *cli.Context) Network {
|
|||
|
||||
tlsConfig := &tls.Config{
|
||||
RootCAs: certs,
|
||||
InsecureSkipVerify: skip, //nolint:gosec
|
||||
InsecureSkipVerify: skipVerify, //nolint:gosec
|
||||
}
|
||||
|
||||
transport := &http.Transport{
|
||||
|
@ -134,8 +134,8 @@ func NetworkFromContext(ctx *cli.Context) Network {
|
|||
}
|
||||
|
||||
return Network{
|
||||
Context: defaultContext,
|
||||
SkipVerify: skip,
|
||||
Client: client,
|
||||
Context: defaultContext,
|
||||
InsecureSkipVerify: skipVerify,
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ func New(opt Options) *Plugin {
|
|||
|
||||
cli.VersionPrinter = func(c *cli.Context) {
|
||||
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{
|
||||
|
|
Loading…
Reference in New Issue