sourcegraph/cmd/repo-updater/shared/debug.go
Erik Seliger e8a2970b6a
Move some debug endpoints from repo-updater to frontend (#59791)
They're not specific to repo-updater internals and can live anywhere. This moves them away from it, in an attempt to make the service leaner.
2024-01-29 10:14:33 +01:00

31 lines
804 B
Go

package shared
import (
"net/http"
"github.com/sourcegraph/sourcegraph/internal/debugserver"
)
func createDebugServerEndpoints(ready chan struct{}, debugserverEndpoints *LazyDebugserverEndpoint) []debugserver.Endpoint {
return []debugserver.Endpoint{
{
Name: "Repo Updater State",
Path: "/repo-updater-state",
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// wait until we're healthy to respond
<-ready
// repoUpdaterStateEndpoint is guaranteed to be assigned now
debugserverEndpoints.repoUpdaterStateEndpoint(w, r)
}),
},
{
Name: "Manual Repo Purge",
Path: "/manual-purge",
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
<-ready
debugserverEndpoints.manualPurgeEndpoint(w, r)
}),
},
}
}