chore: change debug api addr to localhost:7777, fix makefile

This commit is contained in:
yusing 2025-04-14 06:28:23 +08:00
parent a2e253591c
commit dcd21b2374
3 changed files with 5 additions and 2 deletions

1
.gitignore vendored
View file

@ -11,6 +11,7 @@ error_pages/
!examples/error_pages/
profiles/
data/
debug/
logs/
log/

View file

@ -50,6 +50,8 @@ export GODEBUG
export GORACE
export BUILD_FLAGS
.PHONY: debug
test:
GODOXY_TEST=1 go test ./internal/...

View file

@ -22,7 +22,7 @@ import (
func StartServer(cfg config.ConfigInstance) {
srv := server.NewServer(server.Options{
Name: "debug",
HTTPAddr: ":8899",
HTTPAddr: "127.0.0.1:7777",
Handler: newHandler(cfg),
})
srv.Start(task.RootTask("debug_server", false))
@ -67,7 +67,7 @@ func iterMap[K comparable, V debuggable](m func() map[K]V) iter.Seq2[K, V] {
func newHandler(cfg config.ConfigInstance) http.Handler {
mux := servemux.NewServeMux(cfg)
mux.HandleFunc("GET", "/tasks", jsonHandler(task.AllTasks()))
mux.HandleFunc("GET", "/idlewatcher", jsonHandler(iterMap(idlewatcher.Watchers)))
mux.HandleFunc("GET", "/idlewatcher", jsonHandler(idlewatcher.Watchers()))
mux.HandleFunc("GET", "/agents", jsonHandler(agent.Agents.Iter))
mux.HandleFunc("GET", "/proxmox", jsonHandler(proxmox.Clients.Iter))
mux.HandleFunc("GET", "/docker", jsonHandler(iterMap(docker.Clients)))