MCPcopy Index your code
hub / github.com/0xUnixIO/pulse / handleNodeConfig

Method handleNodeConfig

internal/serverapi/api.go:431–449  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, nodeID string)

Source from the content-addressed store, hash-verified

429}
430
431func (a *API) handleNodeConfig(w http.ResponseWriter, r *http.Request, nodeID string) {
432 if r.Method != http.MethodGet {
433 writeMethodNotAllowed(w, http.MethodGet)
434 return
435 }
436 client, err := a.clientFor(nodeID)
437 if err != nil {
438 writeNodeError(w, err)
439 return
440 }
441 ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second)
442 defer cancel()
443 out, err := client.Config(ctx)
444 if err != nil {
445 writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()})
446 return
447 }
448 writeJSON(w, http.StatusOK, out)
449}
450
451func (a *API) handleNodeLogs(w http.ResponseWriter, r *http.Request, nodeID string) {
452 if r.Method != http.MethodGet {

Callers 1

handleNodeRoutesMethod · 0.95

Calls 6

clientForMethod · 0.95
writeMethodNotAllowedFunction · 0.85
writeNodeErrorFunction · 0.85
writeJSONFunction · 0.70
ConfigMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected