Skip to content

Commit

Permalink
Remove Config in Handlers (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelCduBois authored Jan 4, 2025
2 parents 0fd973b + fa280f4 commit 7e3029b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions handler/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package handler

import (
"embed"
"github.com/labstack/echo/v4"
"github.com/leagueify/account/internal/config"
"net/http"

"github.com/labstack/echo/v4"
)

var (
Expand All @@ -15,18 +15,16 @@ var (

type httpHandler struct {
app *echo.Echo
cfg *config.Config
}

func (h *httpHandler) Initialize() {
group := h.app.Group("/account")
group.StaticFS("/docs", docFS)
group.GET("/healthz", healthz)
}
func HTTP(app *echo.Echo, cfg *config.Config) Handler {
func HTTP(app *echo.Echo) Handler {
return &httpHandler{
app: app,
cfg: cfg,
}
}
func healthz(ctx echo.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/integrations/server/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *echoServer) Start() {
))
s.app.Use(middleware.Recover())
// register http handler
handler.HTTP(s.app, s.cfg).Initialize()
handler.HTTP(s.app).Initialize()
showStartBanner()
// start server
s.app.Logger.Fatal(s.app.Start(fmt.Sprintf(":%d", s.cfg.Server.Port)))
Expand Down

0 comments on commit 7e3029b

Please sign in to comment.