From 786c4d2cd0860032e2624cadbbf54891d4269ae2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 25 Apr 2025 15:36:04 -0600 Subject: refactor: move key pacakge to cfg --- app/controllers/dashboard/controller.go | 4 ++-- app/controllers/dashboard/controller_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app/controllers/dashboard') diff --git a/app/controllers/dashboard/controller.go b/app/controllers/dashboard/controller.go index a1d1bbf..ef5b18d 100644 --- a/app/controllers/dashboard/controller.go +++ b/app/controllers/dashboard/controller.go @@ -4,9 +4,9 @@ import ( "net/http" "github.com/xlgmokha/x/pkg/log" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/middleware" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/views" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/key" ) type Controller struct { @@ -23,7 +23,7 @@ func (c *Controller) MountTo(mux *http.ServeMux) { } func (c *Controller) Show(w http.ResponseWriter, r *http.Request) { - currentUser := key.CurrentUser.From(r.Context()) + currentUser := cfg.CurrentUser.From(r.Context()) w.WriteHeader(http.StatusOK) w.Header().Add("Content-Type", "text/html") diff --git a/app/controllers/dashboard/controller_test.go b/app/controllers/dashboard/controller_test.go index 20e16ce..ced3fd5 100644 --- a/app/controllers/dashboard/controller_test.go +++ b/app/controllers/dashboard/controller_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/stretchr/testify/assert" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/domain" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/key" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/test" ) @@ -30,7 +30,7 @@ func TestController(t *testing.T) { t.Run("when authenticated", func(t *testing.T) { t.Run("renders a dashboard page", func(t *testing.T) { - ctx := key.CurrentUser.With(t.Context(), &domain.User{}) + ctx := cfg.CurrentUser.With(t.Context(), &domain.User{}) r, w := test.RequestResponse("GET", "/dashboard", test.WithContext(ctx)) mux.ServeHTTP(w, r) -- cgit v1.2.3