Skip to content

Commit

Permalink
Bump up rk-entry version to v2.2.10 & switch path to filepath in codes
Browse files Browse the repository at this point in the history
  • Loading branch information
dongxuny committed Nov 1, 2022
1 parent e82c872 commit b64f532
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 82 deletions.
40 changes: 20 additions & 20 deletions boot/zero_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
"go.uber.org/zap"
"net/http"
"net/http/pprof"
"path"
"path/filepath"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -118,7 +118,7 @@ type ZeroEntry struct {

// RegisterZeroEntryYAML register zero entries with provided config file (Must YAML file).
//
// Currently, support two ways to provide config file path.
// Currently, support two ways to provide config file filepath.
// 1: With function parameters
// 2: With command line flag "--rkboot" described in rkcommon.BootConfigPathFlagKey (Will override function parameter if exists)
// Command line flag has high priority which would override function parameter
Expand Down Expand Up @@ -357,13 +357,13 @@ func (entry *ZeroEntry) Bootstrap(ctx context.Context) {
// for sw/
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.SwEntry.Path),
Path: filepath.Join(entry.SwEntry.Path),
Handler: entry.SwEntry.ConfigFileHandler(),
})
// for sw/*
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.SwEntry.Path, ":*"),
Path: filepath.Join(entry.SwEntry.Path, ":*"),
Handler: entry.SwEntry.ConfigFileHandler(),
})

Expand Down Expand Up @@ -419,12 +419,12 @@ func (entry *ZeroEntry) Bootstrap(ctx context.Context) {
// Bootstrap Docs entry.
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.DocsEntry.Path),
Path: filepath.Join(entry.DocsEntry.Path),
Handler: entry.DocsEntry.ConfigFileHandler(),
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.DocsEntry.Path, ":*"),
Path: filepath.Join(entry.DocsEntry.Path, ":*"),
Handler: entry.DocsEntry.ConfigFileHandler(),
})

Expand All @@ -435,62 +435,62 @@ func (entry *ZeroEntry) Bootstrap(ctx context.Context) {
if entry.IsPProfEnabled() {
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path),
Path: filepath.Join(entry.PProfEntry.Path),
Handler: pprof.Index,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "cmdline"),
Path: filepath.Join(entry.PProfEntry.Path, "cmdline"),
Handler: pprof.Cmdline,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "profile"),
Path: filepath.Join(entry.PProfEntry.Path, "profile"),
Handler: pprof.Profile,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "symbol"),
Path: filepath.Join(entry.PProfEntry.Path, "symbol"),
Handler: pprof.Symbol,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodPost,
Path: path.Join(entry.PProfEntry.Path, "symbol"),
Path: filepath.Join(entry.PProfEntry.Path, "symbol"),
Handler: pprof.Symbol,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "trace"),
Path: filepath.Join(entry.PProfEntry.Path, "trace"),
Handler: pprof.Trace,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "allocs"),
Path: filepath.Join(entry.PProfEntry.Path, "allocs"),
Handler: pprof.Handler("allocs").ServeHTTP,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "block"),
Path: filepath.Join(entry.PProfEntry.Path, "block"),
Handler: pprof.Handler("block").ServeHTTP,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "goroutine"),
Path: filepath.Join(entry.PProfEntry.Path, "goroutine"),
Handler: pprof.Handler("goroutine").ServeHTTP,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "heap"),
Path: filepath.Join(entry.PProfEntry.Path, "heap"),
Handler: pprof.Handler("heap").ServeHTTP,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "mutex"),
Path: filepath.Join(entry.PProfEntry.Path, "mutex"),
Handler: pprof.Handler("mutex").ServeHTTP,
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.PProfEntry.Path, "threadcreate"),
Path: filepath.Join(entry.PProfEntry.Path, "threadcreate"),
Handler: pprof.Handler("threadcreate").ServeHTTP,
})
}
Expand All @@ -500,12 +500,12 @@ func (entry *ZeroEntry) Bootstrap(ctx context.Context) {
// Bootstrap Docs entry.
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.StaticFileEntry.Path),
Path: filepath.Join(entry.StaticFileEntry.Path),
Handler: entry.StaticFileEntry.GetFileHandler(),
})
entry.Server.AddRoute(rest.Route{
Method: http.MethodGet,
Path: path.Join(entry.StaticFileEntry.Path, ":*"),
Path: filepath.Join(entry.StaticFileEntry.Path, ":*"),
Handler: entry.StaticFileEntry.GetFileHandler(),
})

Expand Down
43 changes: 21 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ go 1.17

require (
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/prometheus/client_golang v1.12.2
github.com/rookie-ninja/rk-entry/v2 v2.2.9
github.com/prometheus/client_golang v1.13.0
github.com/rookie-ninja/rk-entry/v2 v2.2.10
github.com/rookie-ninja/rk-logger v1.2.12
github.com/rookie-ninja/rk-query v1.2.14
github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e
github.com/stretchr/testify v1.7.1
github.com/stretchr/testify v1.8.0
github.com/swaggo/swag v1.8.2
github.com/zeromicro/go-zero v1.3.4
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
github.com/zeromicro/go-zero v1.4.2
go.opentelemetry.io/otel v1.11.0
go.opentelemetry.io/otel/trace v1.11.0
go.uber.org/zap v1.21.0
)

Expand All @@ -39,7 +39,6 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/justinas/alice v1.2.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
Expand All @@ -48,11 +47,11 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/openzipkin/zipkin-go v0.4.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
Expand All @@ -61,27 +60,27 @@ require (
github.com/spf13/viper v1.12.0 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
go.opentelemetry.io/contrib v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.11.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
go.opentelemetry.io/otel/sdk v1.11.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/automaxprocs v1.5.1 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/ratelimit v0.2.0 // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/net v0.0.0-20220531201128-c960675eff93 // indirect
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.10 // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
google.golang.org/grpc v1.46.2 // indirect
google.golang.org/protobuf v1.28.0 // indirect
google.golang.org/genproto v0.0.0-20220602131408-e326c6e8e9c8 // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit b64f532

Please sign in to comment.