diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-25 11:08:58 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-25 11:08:58 -0600 |
| commit | 2b1e14690ea6426a67c0faaaddcfb8aa7360dce7 (patch) | |
| tree | 7f764225e3e3a26bbd7532e72ab99a54e465be92 | |
| parent | 0053db0d265af313dd281db5cf1e73236cde30c6 (diff) | |
refactor: move db and mountable to app
| -rw-r--r-- | app/app.go | 9 | ||||
| -rw-r--r-- | app/controllers/dashboard/controller.go | 2 | ||||
| -rw-r--r-- | app/controllers/sparkles/controller.go | 2 | ||||
| -rw-r--r-- | app/controllers/sparkles/controller_test.go | 2 | ||||
| -rw-r--r-- | app/db/in_memory_repository.go (renamed from pkg/db/in_memory_repository.go) | 0 | ||||
| -rw-r--r-- | app/db/in_memory_repository_test.go (renamed from pkg/db/in_memory_repository_test.go) | 0 | ||||
| -rw-r--r-- | app/init.go | 2 | ||||
| -rw-r--r-- | app/middleware/id_token.go (renamed from pkg/web/middleware/id_token.go) | 0 | ||||
| -rw-r--r-- | app/middleware/id_token_test.go (renamed from pkg/web/middleware/id_token_test.go) | 0 | ||||
| -rw-r--r-- | app/middleware/init.go (renamed from pkg/web/middleware/init.go) | 0 | ||||
| -rw-r--r-- | app/middleware/require_user.go (renamed from pkg/web/middleware/require_user.go) | 0 | ||||
| -rw-r--r-- | app/middleware/require_user_test.go (renamed from pkg/web/middleware/require_user_test.go) | 0 | ||||
| -rw-r--r-- | app/middleware/user.go (renamed from pkg/web/middleware/user.go) | 0 | ||||
| -rw-r--r-- | app/middleware/user_test.go (renamed from pkg/web/middleware/user_test.go) | 2 | ||||
| -rw-r--r-- | pkg/web/mountable.go | 7 |
15 files changed, 11 insertions, 15 deletions
@@ -12,15 +12,18 @@ import ( "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/controllers/sessions" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/controllers/sparkles" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/domain" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/middleware" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web/middleware" ) +type Mountable interface { + MountTo(*http.ServeMux) +} + func New(rootDir string) http.Handler { mux := ioc.MustResolve[*http.ServeMux](ioc.Default) - mountable := []web.Mountable{ + mountable := []Mountable{ ioc.MustResolve[*dashboard.Controller](ioc.Default), ioc.MustResolve[*health.Controller](ioc.Default), ioc.MustResolve[*sessions.Controller](ioc.Default), diff --git a/app/controllers/dashboard/controller.go b/app/controllers/dashboard/controller.go index 65b2fe5..a1d1bbf 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/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" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web/middleware" ) type Controller struct { diff --git a/app/controllers/sparkles/controller.go b/app/controllers/sparkles/controller.go index 5cdb60d..9c319b2 100644 --- a/app/controllers/sparkles/controller.go +++ b/app/controllers/sparkles/controller.go @@ -8,7 +8,7 @@ import ( "github.com/xlgmokha/x/pkg/serde" "github.com/xlgmokha/x/pkg/x" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/domain" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web/middleware" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/middleware" ) type Controller struct { diff --git a/app/controllers/sparkles/controller_test.go b/app/controllers/sparkles/controller_test.go index 65a9622..21f4ec7 100644 --- a/app/controllers/sparkles/controller_test.go +++ b/app/controllers/sparkles/controller_test.go @@ -7,8 +7,8 @@ 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/db" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/domain" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/db" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/key" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/test" ) diff --git a/pkg/db/in_memory_repository.go b/app/db/in_memory_repository.go index 5b84dbf..5b84dbf 100644 --- a/pkg/db/in_memory_repository.go +++ b/app/db/in_memory_repository.go diff --git a/pkg/db/in_memory_repository_test.go b/app/db/in_memory_repository_test.go index bd9d12f..bd9d12f 100644 --- a/pkg/db/in_memory_repository_test.go +++ b/app/db/in_memory_repository_test.go diff --git a/app/init.go b/app/init.go index a42d2f7..968303b 100644 --- a/app/init.go +++ b/app/init.go @@ -13,8 +13,8 @@ import ( "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/controllers/health" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/controllers/sessions" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/controllers/sparkles" + "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/db" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web" "golang.org/x/oauth2" diff --git a/pkg/web/middleware/id_token.go b/app/middleware/id_token.go index a32c77b..a32c77b 100644 --- a/pkg/web/middleware/id_token.go +++ b/app/middleware/id_token.go diff --git a/pkg/web/middleware/id_token_test.go b/app/middleware/id_token_test.go index 4f26cdf..4f26cdf 100644 --- a/pkg/web/middleware/id_token_test.go +++ b/app/middleware/id_token_test.go diff --git a/pkg/web/middleware/init.go b/app/middleware/init.go index f1a693d..f1a693d 100644 --- a/pkg/web/middleware/init.go +++ b/app/middleware/init.go diff --git a/pkg/web/middleware/require_user.go b/app/middleware/require_user.go index e81d5b5..e81d5b5 100644 --- a/pkg/web/middleware/require_user.go +++ b/app/middleware/require_user.go diff --git a/pkg/web/middleware/require_user_test.go b/app/middleware/require_user_test.go index 68b9911..68b9911 100644 --- a/pkg/web/middleware/require_user_test.go +++ b/app/middleware/require_user_test.go diff --git a/pkg/web/middleware/user.go b/app/middleware/user.go index 194ded6..194ded6 100644 --- a/pkg/web/middleware/user.go +++ b/app/middleware/user.go diff --git a/pkg/web/middleware/user_test.go b/app/middleware/user_test.go index b09fa7b..e6c74d8 100644 --- a/pkg/web/middleware/user_test.go +++ b/app/middleware/user_test.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "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/db" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/key" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls" diff --git a/pkg/web/mountable.go b/pkg/web/mountable.go deleted file mode 100644 index 6e04b86..0000000 --- a/pkg/web/mountable.go +++ /dev/null @@ -1,7 +0,0 @@ -package web - -import "net/http" - -type Mountable interface { - MountTo(*http.ServeMux) -} |
