Skip to content

Commit

Permalink
Merge pull request #36 from dongxuny/master
Browse files Browse the repository at this point in the history
Bump up rk-entry to latest one
  • Loading branch information
dongxuny authored Dec 14, 2022
2 parents 71345e1 + b0a3626 commit 6d5a4d7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 405 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Setup golangci-lint
uses: golangci/golangci-lint-action@v2.5.2
- name: Run linter
Expand Down
28 changes: 14 additions & 14 deletions boot/echo_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
"go.uber.org/zap"
"net/http"
"net/http/pprof"
"path/filepath"
"path"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -378,7 +378,7 @@ func (entry *EchoEntry) Bootstrap(ctx context.Context) {
ctx.Redirect(http.StatusTemporaryRedirect, entry.SwEntry.Path)
return nil
})
entry.Echo.GET(filepath.Join(entry.SwEntry.Path, "*"), echo.WrapHandler(entry.SwEntry.ConfigFileHandler()))
entry.Echo.GET(path.Join(entry.SwEntry.Path, "*"), echo.WrapHandler(entry.SwEntry.ConfigFileHandler()))
entry.SwEntry.Bootstrap(ctx)
}

Expand All @@ -389,7 +389,7 @@ func (entry *EchoEntry) Bootstrap(ctx context.Context) {
ctx.Redirect(http.StatusTemporaryRedirect, entry.DocsEntry.Path)
return nil
})
entry.Echo.GET(filepath.Join(entry.DocsEntry.Path, "*"), echo.WrapHandler(entry.DocsEntry.ConfigFileHandler()))
entry.Echo.GET(path.Join(entry.DocsEntry.Path, "*"), echo.WrapHandler(entry.DocsEntry.ConfigFileHandler()))

entry.DocsEntry.Bootstrap(ctx)
}
Expand All @@ -403,7 +403,7 @@ func (entry *EchoEntry) Bootstrap(ctx context.Context) {
})

// Register path into Router.
entry.Echo.GET(filepath.Join(entry.StaticFileEntry.Path, "*"), echo.WrapHandler(entry.StaticFileEntry.GetFileHandler()))
entry.Echo.GET(path.Join(entry.StaticFileEntry.Path, "*"), echo.WrapHandler(entry.StaticFileEntry.GetFileHandler()))
entry.StaticFileEntry.Bootstrap(ctx)
}

Expand All @@ -419,16 +419,16 @@ func (entry *EchoEntry) Bootstrap(ctx context.Context) {
// Is pprof enabled?
if entry.IsPProfEnabled() {
entry.Echo.GET(entry.PProfEntry.Path, echo.WrapHandler(http.HandlerFunc(pprof.Index)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "cmdline"), echo.WrapHandler(http.HandlerFunc(pprof.Cmdline)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "profile"), echo.WrapHandler(http.HandlerFunc(pprof.Profile)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "symbol"), echo.WrapHandler(http.HandlerFunc(pprof.Symbol)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "trace"), echo.WrapHandler(http.HandlerFunc(pprof.Trace)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "allocs"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("allocs").ServeHTTP)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "block"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("block").ServeHTTP)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "goroutine"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("goroutine").ServeHTTP)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "heap"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("heap").ServeHTTP)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "mutex"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("mutex").ServeHTTP)))
entry.Echo.GET(filepath.Join(entry.PProfEntry.Path, "threadcreate"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("threadcreate").ServeHTTP)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "cmdline"), echo.WrapHandler(http.HandlerFunc(pprof.Cmdline)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "profile"), echo.WrapHandler(http.HandlerFunc(pprof.Profile)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "symbol"), echo.WrapHandler(http.HandlerFunc(pprof.Symbol)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "trace"), echo.WrapHandler(http.HandlerFunc(pprof.Trace)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "allocs"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("allocs").ServeHTTP)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "block"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("block").ServeHTTP)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "goroutine"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("goroutine").ServeHTTP)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "heap"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("heap").ServeHTTP)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "mutex"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("mutex").ServeHTTP)))
entry.Echo.GET(path.Join(entry.PProfEntry.Path, "threadcreate"), echo.WrapHandler(http.HandlerFunc(pprof.Handler("threadcreate").ServeHTTP)))
}

// Start echo server
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/rookie-ninja/rk-echo

go 1.17
go 1.18

require (
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/labstack/echo/v4 v4.9.1
github.com/prometheus/client_golang v1.13.0
github.com/rookie-ninja/rk-entry/v2 v2.2.11
github.com/rookie-ninja/rk-entry/v2 v2.2.13
github.com/rookie-ninja/rk-logger v1.2.12
github.com/rookie-ninja/rk-query v1.2.14
github.com/rs/xid v1.3.0
Expand Down
Loading

0 comments on commit 6d5a4d7

Please sign in to comment.