fix drone and sqlc generation
Some checks failed
continuous-integration/drone/push Build was killed

This commit is contained in:
2026-01-13 19:49:13 +11:00
parent ea1eeb5c21
commit a81613a8c2
28 changed files with 3718 additions and 288 deletions

View File

@@ -1,6 +1,7 @@
package router
import (
"io/fs"
"log/slog"
"net/http"
"net/http/pprof"
@@ -46,10 +47,31 @@ func New(logger *slog.Logger, database db.Database, buildTime string, sha1ver st
mux.HandleFunc("/api/report/inventory", h.InventoryReportDownload)
mux.HandleFunc("/api/report/updates", h.UpdateReportDownload)
mux.HandleFunc("/api/report/snapshot", h.SnapshotReportDownload)
mux.HandleFunc("/snapshots/hourly", h.SnapshotHourlyList)
mux.HandleFunc("/snapshots/daily", h.SnapshotDailyList)
mux.HandleFunc("/snapshots/monthly", h.SnapshotMonthlyList)
// endpoint for encrypting vcenter credential
mux.HandleFunc("/api/encrypt", h.EncryptData)
// serve swagger related components from the embedded fs
swaggerSub, err := fs.Sub(swaggerUI, "swagger-ui-dist")
if err != nil {
logger.Error("failed to load swagger ui assets", "error", err)
} else {
mux.Handle("/swagger/", http.StripPrefix("/swagger/", http.FileServer(http.FS(swaggerSub))))
}
mux.HandleFunc("/swagger", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/swagger/", http.StatusPermanentRedirect)
})
mux.HandleFunc("/swagger.json", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(swaggerSpec)
})
// Register pprof handlers
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)