From 76f0753f2114da1872f0ad286ddd7ebf45e73894 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 15 May 2025 16:16:39 -0600 Subject: chore: allow envoy to handle health checks --- app/app.go | 2 -- app/app_test.go | 7 ------- app/controllers/health/controller.go | 18 ------------------ app/init.go | 4 ---- 4 files changed, 31 deletions(-) delete mode 100644 app/controllers/health/controller.go (limited to 'app') diff --git a/app/app.go b/app/app.go index 23f49bb..5bcc69a 100644 --- a/app/app.go +++ b/app/app.go @@ -10,7 +10,6 @@ import ( "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/controllers/dashboard" - "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/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" @@ -25,7 +24,6 @@ func New(rootDir string) http.Handler { mountable := []Mountable{ ioc.MustResolve[*dashboard.Controller](ioc.Default), - ioc.MustResolve[*health.Controller](ioc.Default), ioc.MustResolve[*sparkles.Controller](ioc.Default), } for _, m := range mountable { diff --git a/app/app_test.go b/app/app_test.go index 8817a3c..f1cc28c 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -23,12 +23,5 @@ func TestApp(t *testing.T) { assert.Equal(t, http.StatusOK, response.Code) assert.Contains(t, response.Body.String(), "SparkleLab") }) - - t.Run("GET /health", func(t *testing.T) { - response := httptest.NewRecorder() - - server.ServeHTTP(response, test.Request("GET", "/health")) - assert.Equal(t, http.StatusOK, response.Code) - }) }) } diff --git a/app/controllers/health/controller.go b/app/controllers/health/controller.go deleted file mode 100644 index 5bcff66..0000000 --- a/app/controllers/health/controller.go +++ /dev/null @@ -1,18 +0,0 @@ -package health - -import "net/http" - -type Controller struct { -} - -func New() *Controller { - return &Controller{} -} - -func (c *Controller) MountTo(mux *http.ServeMux) { - mux.HandleFunc("GET /health", c.Index) -} - -func (c *Controller) Index(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) -} diff --git a/app/init.go b/app/init.go index 7ea0dd2..868c2f7 100644 --- a/app/init.go +++ b/app/init.go @@ -11,7 +11,6 @@ import ( "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/controllers/dashboard" - "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/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" @@ -38,9 +37,6 @@ func init() { ioc.Register[*sparkles.Controller](ioc.Default, func() *sparkles.Controller { return sparkles.New(ioc.MustResolve[domain.Repository[*domain.Sparkle]](ioc.Default)) }) - ioc.Register[*health.Controller](ioc.Default, func() *health.Controller { - return health.New() - }) ioc.RegisterSingleton[*http.Client](ioc.Default, func() *http.Client { return &http.Client{ Transport: &web.Transport{ -- cgit v1.2.3