Skip to content

Commit

Permalink
fix(server): config is not present at server instanciation
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-pad committed May 21, 2024
1 parent ce70baf commit 4881451
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 1 addition & 6 deletions internal/server/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ type API struct {
}

func New(c *config.Config) *API {
client := datastore.NewDefaultClient()
if c.Datastore.TLS {
client.Scheme = "https"
}
return &API{
config: c,
Datastore: client,
config: c,
}
}
6 changes: 6 additions & 0 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/padok-team/burrito/internal/burrito/config"
datastore "github.com/padok-team/burrito/internal/datastore/client"
"github.com/padok-team/burrito/internal/server/api"
"github.com/padok-team/burrito/internal/webhook"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -53,6 +54,11 @@ func initClient() (*client.Client, error) {
}

func (s *Server) Exec() {
datastore := datastore.NewDefaultClient()
if s.config.Datastore.TLS {
datastore.Scheme = "https"
}
s.API.Datastore = datastore
err := s.Webhook.Init()
if err != nil {
log.Fatalf("error initializing webhook: %s", err)
Expand Down

0 comments on commit 4881451

Please sign in to comment.