diff --git a/internal/datastore/datastore.go b/internal/datastore/datastore.go index 58655fbb..ad57feea 100644 --- a/internal/datastore/datastore.go +++ b/internal/datastore/datastore.go @@ -35,12 +35,11 @@ func (s *Datastore) Exec() { authz.SetAudience("burrito") log.Infof("starting burrito datastore...") e := echo.New() - e.Use(middleware.Logger()) - healthz := e.Group("/healthz") healthz.GET("", handleHealthz) api := e.Group("/api") + api.Use(middleware.Logger()) api.Use(authz.Process) api.GET("/logs", s.API.GetLogsHandler) api.PUT("/logs", s.API.PutLogsHandler) diff --git a/internal/server/server.go b/internal/server/server.go index b4638c7f..35a5ca9f 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -66,7 +66,6 @@ func (s *Server) Exec() { s.Webhook.Client = s.client log.Infof("starting burrito server...") e := echo.New() - e.Use(middleware.Logger()) e.Use(middleware.StaticWithConfig( middleware.StaticConfig{ Filesystem: s.staticAssets, @@ -75,12 +74,14 @@ func (s *Server) Exec() { HTML5: true, }, )) + api := e.Group("/api") + api.Use(middleware.Logger()) e.GET("/healthz", handleHealthz) - e.POST("/api/webhook", s.Webhook.GetHttpHandler()) - e.GET("/api/layers", s.API.LayersHandler) - e.GET("/api/repositories", s.API.RepositoriesHandler) - e.GET("/api/logs/:namespace/:layer/:run/:attempt", s.API.GetLogsHandler) - e.GET("/api/run/:namespace/:layer/:run/attempts", s.API.GetAttemptsHandler) + api.POST("/webhook", s.Webhook.GetHttpHandler()) + api.GET("/layers", s.API.LayersHandler) + api.GET("/repositories", s.API.RepositoriesHandler) + api.GET("/logs/:namespace/:layer/:run/:attempt", s.API.GetLogsHandler) + api.GET("/run/:namespace/:layer/:run/attempts", s.API.GetAttemptsHandler) e.Logger.Fatal(e.Start(s.config.Server.Addr)) log.Infof("burrito server started on addr %s", s.config.Server.Addr)