| 42 | } |
| 43 | |
| 44 | func (c *pgCoord) ServeHTTPDebug(w http.ResponseWriter, r *http.Request) { |
| 45 | ctx := r.Context() |
| 46 | debug, err := getDebug(ctx, c.store) |
| 47 | if err != nil { |
| 48 | w.WriteHeader(http.StatusInternalServerError) |
| 49 | _, _ = w.Write([]byte(err.Error())) |
| 50 | return |
| 51 | } |
| 52 | |
| 53 | w.Header().Set("Content-Type", "text/html; charset=utf-8") |
| 54 | |
| 55 | err = debugTempl.Execute(w, debug) |
| 56 | if err != nil { |
| 57 | w.WriteHeader(http.StatusInternalServerError) |
| 58 | _, _ = w.Write([]byte(err.Error())) |
| 59 | return |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func getDebug(ctx context.Context, store database.Store) (HTMLDebug, error) { |
| 64 | out := HTMLDebug{} |