Просмотр исходного кода

fix errors caused by apierrors re-interfacing

Alexander Belanger 4 лет назад
Родитель
Сommit
c0d0667a88
2 измененных файлов с 9 добавлено и 8 удалено
  1. 4 4
      api/server/authz/namespace.go
  2. 5 4
      api/server/handlers/namespace/list_releases.go

+ 4 - 4
api/server/authz/namespace.go

@@ -5,16 +5,16 @@ import (
 	"net/http"
 
 	"github.com/porter-dev/porter/api/server/authz/policy"
-	"github.com/porter-dev/porter/api/server/shared"
+	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
 )
 
 type NamespaceScopedFactory struct {
-	config *shared.Config
+	config *config.Config
 }
 
 func NewNamespaceScopedFactory(
-	config *shared.Config,
+	config *config.Config,
 ) *NamespaceScopedFactory {
 	return &NamespaceScopedFactory{config}
 }
@@ -25,7 +25,7 @@ func (p *NamespaceScopedFactory) Middleware(next http.Handler) http.Handler {
 
 type NamespaceScopedMiddleware struct {
 	next   http.Handler
-	config *shared.Config
+	config *config.Config
 }
 
 func (n *NamespaceScopedMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {

+ 5 - 4
api/server/handlers/namespace/list_releases.go

@@ -7,6 +7,7 @@ import (
 	"github.com/porter-dev/porter/api/server/handlers"
 	"github.com/porter-dev/porter/api/server/shared"
 	"github.com/porter-dev/porter/api/server/shared/apierrors"
+	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
 	"github.com/porter-dev/porter/internal/models"
 )
@@ -17,7 +18,7 @@ type ListReleasesHandler struct {
 }
 
 func NewListReleasesHandler(
-	config *shared.Config,
+	config *config.Config,
 	decoderValidator shared.RequestDecoderValidator,
 	writer shared.ResultWriter,
 ) *ListReleasesHandler {
@@ -40,18 +41,18 @@ func (c *ListReleasesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
 	helmAgent, err := c.GetHelmAgent(r, cluster)
 
 	if err != nil {
-		c.HandleAPIError(w, apierrors.NewErrInternal(err))
+		c.HandleAPIError(r.Context(), w, apierrors.NewErrInternal(err))
 		return
 	}
 
 	releases, err := helmAgent.ListReleases(namespace, request.ReleaseListFilter)
 
 	if err != nil {
-		c.HandleAPIError(w, apierrors.NewErrInternal(err))
+		c.HandleAPIError(r.Context(), w, apierrors.NewErrInternal(err))
 		return
 	}
 
 	var res types.ListReleasesResponse = releases
 
-	c.WriteResult(w, res)
+	c.WriteResult(r.Context(), w, res)
 }