Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update debug level info #26

Merged
merged 6 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 38 additions & 9 deletions dumper/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type Dumper struct {
func (c Dumper) Dump(v config.ServiceConfig) error {
c.cmd.Printf("%sGlobal settings%s\n", c.colorGreen, c.colorReset)
c.cmd.Printf("%sName: %s\n", c.checkDumpPrefix, v.Name)
c.cmd.Printf("%sVersion: %d\n", c.checkDumpPrefix, v.Version)
c.cmd.Printf("%sAddress: %d\n", c.checkDumpPrefix, v.Address)
kpacha marked this conversation as resolved.
Show resolved Hide resolved
c.cmd.Printf("%sPort: %d\n", c.checkDumpPrefix, v.Port)

if c.verboseLevel > 1 {
Expand Down Expand Up @@ -76,27 +78,51 @@ func (c Dumper) Dump(v config.ServiceConfig) error {
c.cmd.Printf("%sMax idle connections: %d\n", c.checkDumpPrefix, v.MaxIdleConns)
c.cmd.Printf("%sMax idle connections per host: %d\n", c.checkDumpPrefix, v.MaxIdleConnsPerHost)
c.cmd.Printf("%sSequential start: %t\n", c.checkDumpPrefix, v.SequentialStart)

c.cmd.Printf("%sMax header bytes: %d\n", c.checkDumpPrefix, v.MaxHeaderBytes)
c.cmd.Printf("%sEcho endpoint enabled: %t\n", c.checkDumpPrefix, v.Echo)
c.cmd.Printf("%sDefault encoding strategy: %s\n", c.checkDumpPrefix, v.OutputEncoding)
c.cmd.Printf("%sDisable strict REST: %t\n", c.checkDumpPrefix, v.DisableStrictREST)
c.cmd.Printf("%sRun lura in debug mode: %t\n", c.checkDumpPrefix, v.Debug)
c.cmd.Printf("%sAllow insecure connections: %t\n", c.checkDumpPrefix, v.AllowInsecureConnections)
c.cmd.Printf("%sUseH2C: %t\n", c.checkDumpPrefix, v.UseH2C)
}

if v.TLS != nil {
c.cmd.Printf("%sDisabled: %v\n", c.checkDumpPrefix, v.TLS.IsDisabled)
c.cmd.Printf("%sPublic key: %s\n", c.checkDumpPrefix, v.TLS.PublicKey)
c.cmd.Printf("%sPrivate key: %s\n", c.checkDumpPrefix, v.TLS.PrivateKey)
c.cmd.Printf("%sEnable MTLS: %v\n", c.checkDumpPrefix, v.TLS.EnableMTLS)
c.cmd.Printf("%sTLS Disabled: %t\n", c.checkDumpPrefix, v.TLS.IsDisabled)
// TODO: update this with the new field `Keys`:
c.cmd.Printf("%sTLS Public key: %s\n", c.checkDumpPrefix, v.TLS.PublicKey)
c.cmd.Printf("%sTLS Private key: %s\n", c.checkDumpPrefix, v.TLS.PrivateKey)
c.cmd.Printf("%sTLS Enable MTLS: %t\n", c.checkDumpPrefix, v.TLS.EnableMTLS)
c.cmd.Printf("%sTLS Disable System CA Pool: %v\n", c.checkDumpPrefix, v.TLS.DisableSystemCaPool)

if c.verboseLevel > 1 {
c.cmd.Printf("%sMin version: %s\n", c.checkDumpPrefix, v.TLS.MinVersion)
c.cmd.Printf("%sMax version: %s\n", c.checkDumpPrefix, v.TLS.MaxVersion)
c.cmd.Printf("%sTLS Min version: %s\n", c.checkDumpPrefix, v.TLS.MinVersion)
c.cmd.Printf("%sTLS Max version: %s\n", c.checkDumpPrefix, v.TLS.MaxVersion)
}
if c.verboseLevel > 2 {
c.cmd.Printf("%sCurve preferences: %v\n", c.checkDumpPrefix, v.TLS.CurvePreferences)
c.cmd.Printf("%sPrefer server cipher suites: %v\n", c.checkDumpPrefix, v.TLS.PreferServerCipherSuites)
c.cmd.Printf("%sCipher suites: %v\n", c.checkDumpPrefix, v.TLS.CipherSuites)
c.cmd.Printf("%sTLS Curve preferences: %v\n", c.checkDumpPrefix, v.TLS.CurvePreferences)
c.cmd.Printf("%sTLS Prefer server cipher suites: %v\n", c.checkDumpPrefix, v.TLS.PreferServerCipherSuites)
c.cmd.Printf("%sTLS Cipher suites: %v\n", c.checkDumpPrefix, v.TLS.CipherSuites)
}
} else if c.verboseLevel > 1 {
c.cmd.Printf("%s%sNo TLS section defined%s\n", c.checkDumpPrefix, c.colorRed, c.colorReset)
}

if v.ClientTLS != nil {
c.cmd.Printf("%sClient TLS Allow Insecure Connections: %v\n", c.checkDumpPrefix, v.ClientTLS.AllowInsecureConnections)
c.cmd.Printf("%sClient TLS Disable System CA Pool: %v\n", c.checkDumpPrefix, v.ClientTLS.DisableSystemCaPool)

if c.verboseLevel > 1 {
c.cmd.Printf("%sClient TLS Min version: %s\n", c.checkDumpPrefix, v.ClientTLS.MinVersion)
c.cmd.Printf("%sClient TLS Max version: %s\n", c.checkDumpPrefix, v.ClientTLS.MaxVersion)
}
if c.verboseLevel > 2 {
c.cmd.Printf("%sClient TLS Curve preferences: %v\n", c.checkDumpPrefix, v.ClientTLS.CurvePreferences)
c.cmd.Printf("%sClient TLS Cipher suites: %v\n", c.checkDumpPrefix, v.ClientTLS.CipherSuites)
}
}

if v.Plugin != nil {
c.cmd.Printf("%sFolder: %s\n", c.checkDumpPrefix, v.Plugin.Folder)
c.cmd.Printf("%sPattern: %s\n", c.checkDumpPrefix, v.Plugin.Pattern)
Expand Down Expand Up @@ -193,6 +219,9 @@ func (c Dumper) dumpBackend(backend *config.Backend) {
c.cmd.Printf("%sEncoding: %s\n", prefix, backend.Encoding)
c.cmd.Printf("%sIs collection: %+v\n", prefix, backend.IsCollection)
c.cmd.Printf("%sSD: %+v\n", prefix, backend.SD)
c.cmd.Printf("%sSD scheme: %s\n", prefix, backend.SDScheme)
c.cmd.Printf("%sHeaders to pass: %v\n", prefix, backend.HeadersToPass)
c.cmd.Printf("%sQuery strings to pass: %v\n", prefix, backend.QueryStringsToPass)
}

if c.verboseLevel > 1 || len(backend.ExtraConfig) > 0 {
Expand Down
39 changes: 23 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module github.com/krakendio/krakend-cobra/v2
go 1.17

require (
github.com/gin-gonic/gin v1.8.2
github.com/gin-gonic/gin v1.9.1
github.com/krakendio/krakend-audit v0.0.1
github.com/krakendio/krakend-viper/v2 v2.0.1
github.com/luraproject/lura/v2 v2.2.3
github.com/mattn/go-isatty v0.0.17
github.com/luraproject/lura/v2 v2.6.3
github.com/mattn/go-isatty v0.0.19
github.com/santhosh-tekuri/jsonschema/v5 v5.0.0
github.com/spf13/cobra v0.0.5
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
golang.org/x/mod v0.8.0
)

require (
Expand Down Expand Up @@ -47,16 +47,19 @@ require (
github.com/aws/aws-sdk-go-v2/service/sso v1.11.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.16.3 // indirect
github.com/aws/smithy-go v1.11.2 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/clbanning/mxj v1.8.4 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/goccy/go-json v0.9.11 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
Expand Down Expand Up @@ -87,6 +90,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/juju/ratelimit v1.0.1 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/krakendio/bloomfilter/v2 v2.0.4 // indirect
github.com/krakendio/flatmap v1.1.1 // indirect
github.com/krakendio/krakend-botdetector/v2 v2.0.3 // indirect
Expand All @@ -102,7 +106,7 @@ require (
github.com/krakendio/krakend-ratelimit/v2 v2.0.4 // indirect
github.com/krakendio/krakend-rss/v2 v2.0.1 // indirect
github.com/krakendio/krakend-xml/v2 v2.0.1 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
Expand All @@ -117,7 +121,7 @@ require (
github.com/oklog/run v1.1.0 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/rcrowley/go-metrics v0.0.0-20180406234716-d932a24a8ccb // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
Expand All @@ -135,29 +139,32 @@ require (
github.com/tmthrgd/go-hex v0.0.0-20180828131331-d1fb3dbb16a1 // indirect
github.com/tmthrgd/go-memset v0.0.0-20180828131805-6f4e59bf1e1d // indirect
github.com/tmthrgd/go-popcount v0.0.0-20180111143836-3918361d3e97 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/unrolled/secure v0.0.0-20180918153822-f340ee86eb8b // indirect
github.com/valyala/fastrand v1.1.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
gocloud.dev v0.25.0 // indirect
gocloud.dev/secrets/hashivault v0.25.0 // indirect
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.74.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220401170504-314d38edb7de // indirect
google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/Graylog2/go-gelf.v2 v2.0.0-20191017102106-1550ee647df0 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/ugorji/go v1.1.4 => github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43
Loading