diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-25 15:36:04 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-25 15:36:04 -0600 |
| commit | 786c4d2cd0860032e2624cadbbf54891d4269ae2 (patch) | |
| tree | 3ad2aa0e298d97b431982183224c1e8c6a7ed817 /app/controllers | |
| parent | 8836d0744aed44435e35af78d7533ff09db0c62e (diff) | |
refactor: move key pacakge to cfg
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/dashboard/controller.go | 4 | ||||
| -rw-r--r-- | app/controllers/dashboard/controller_test.go | 4 | ||||
| -rw-r--r-- | app/controllers/sparkles/controller_test.go | 4 | ||||
| -rw-r--r-- | app/controllers/sparkles/init.go | 4 |
4 files changed, 8 insertions, 8 deletions
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) diff --git a/app/controllers/sparkles/controller_test.go b/app/controllers/sparkles/controller_test.go index 21f4ec7..c158f32 100644 --- a/app/controllers/sparkles/controller_test.go +++ b/app/controllers/sparkles/controller_test.go @@ -7,9 +7,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/xlgmokha/x/pkg/serde" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/db" "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" ) @@ -58,7 +58,7 @@ func TestSparkles(t *testing.T) { "/sparkles", test.WithAcceptHeader(serde.JSON), test.WithContentType(sparkle, serde.JSON), - test.WithContextKeyValue(t.Context(), key.CurrentUser, currentUser), + test.WithContextKeyValue(t.Context(), cfg.CurrentUser, currentUser), ) mux.ServeHTTP(response, request) diff --git a/app/controllers/sparkles/init.go b/app/controllers/sparkles/init.go index 2586c9a..1118a09 100644 --- a/app/controllers/sparkles/init.go +++ b/app/controllers/sparkles/init.go @@ -6,8 +6,8 @@ import ( "github.com/xlgmokha/x/pkg/log" "github.com/xlgmokha/x/pkg/mapper" "github.com/xlgmokha/x/pkg/serde" + "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" ) func init() { @@ -16,7 +16,7 @@ func init() { if err != nil { log.WithFields(r.Context(), log.Fields{"error": err}) } - sparkle.Author = key.CurrentUser.From(r.Context()) + sparkle.Author = cfg.CurrentUser.From(r.Context()) return sparkle }) } |
