| 186 | } |
| 187 | |
| 188 | func (s *Server) getAgentConfig(c echo.Context) error { |
| 189 | agentID := c.Param("id") |
| 190 | |
| 191 | for k, agentSource := range s.sm.Sources { |
| 192 | if k != agentID { |
| 193 | continue |
| 194 | } |
| 195 | |
| 196 | slog.Debug("API source", "source", agentSource.Name()) |
| 197 | cfg, err := config.Load(c.Request().Context(), agentSource) |
| 198 | if err != nil { |
| 199 | slog.Error("Failed to load config from API source", "key", k, "error", err) |
| 200 | continue |
| 201 | } |
| 202 | |
| 203 | return c.JSON(http.StatusOK, cfg) |
| 204 | } |
| 205 | |
| 206 | return echo.NewHTTPError(http.StatusNotFound) |
| 207 | } |
| 208 | |
| 209 | func (s *Server) getSessions(c echo.Context) error { |
| 210 | sessions, err := s.sm.GetSessions(c.Request().Context()) |