V0.6.2 docs openapi (#37)
All checks were successful
All checks were successful
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #37.
This commit is contained in:
@@ -311,6 +311,15 @@ func main() {
|
||||
patched := bytes.Replace(openapiSpec, []byte("${VERSION}"), []byte(Version), 1)
|
||||
c.Data(http.StatusOK, "application/yaml", patched)
|
||||
})
|
||||
// v0.6.2: Dynamic OpenAPI spec with extension routes merged in
|
||||
base.GET("/api/docs/openapi.json", func(c *gin.Context) {
|
||||
spec, err := handlers.BuildOpenAPISpec(stores, openapiSpec, Version)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to build spec"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, spec)
|
||||
})
|
||||
|
||||
// WebSocket endpoint
|
||||
base.GET("/ws", middleware.WsAuth(cfg, stores.Users, userCache, ticketAdapter), hub.HandleWebSocket)
|
||||
@@ -512,6 +521,12 @@ func main() {
|
||||
protected.GET("/settings", settings.GetSettings)
|
||||
protected.PUT("/settings", settings.UpdateSettings)
|
||||
|
||||
// Documentation (v0.6.1)
|
||||
docsDir := findDocsDir()
|
||||
docsH := handlers.NewDocsHandler(docsDir)
|
||||
protected.GET("/docs", docsH.ListDocs)
|
||||
protected.GET("/docs/:name", docsH.GetDoc)
|
||||
|
||||
// Permission bootstrap (v0.37.1) — self-service resolved permissions
|
||||
permH := handlers.NewProfilePermissionsHandler(stores)
|
||||
protected.GET("/profile/permissions", permH.GetMyPermissions)
|
||||
@@ -793,6 +808,14 @@ func main() {
|
||||
admin.GET("/cluster", clusterH.ListNodes)
|
||||
}
|
||||
|
||||
// ── Backup/Restore (v0.6.1) ─────────
|
||||
backupH := handlers.NewBackupHandler(stores, packagesDir, cfg.StoragePath)
|
||||
admin.POST("/backup", backupH.CreateBackup)
|
||||
admin.GET("/backups", backupH.ListBackups)
|
||||
admin.GET("/backups/:name", backupH.DownloadBackup)
|
||||
admin.DELETE("/backups/:name", backupH.DeleteBackup)
|
||||
admin.POST("/restore", backupH.RestoreBackup)
|
||||
|
||||
// Surface aliases (backward compat — same handlers)
|
||||
admin.GET("/surfaces", pkgAdm.ListPackages)
|
||||
admin.GET("/surfaces/:id", pkgAdm.GetPackage)
|
||||
@@ -898,6 +921,21 @@ func appendClusterHealth(info gin.H, reg *cluster.Registry, stores store.Stores)
|
||||
}
|
||||
}
|
||||
|
||||
// findDocsDir locates the docs/ directory. Checks common locations.
|
||||
func findDocsDir() string {
|
||||
candidates := []string{
|
||||
"docs",
|
||||
"../docs",
|
||||
"/app/docs",
|
||||
}
|
||||
for _, dir := range candidates {
|
||||
if info, err := os.Stat(dir); err == nil && info.IsDir() {
|
||||
return dir
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ── Vault CLI Commands ──────────────────────
|
||||
|
||||
func runVaultCommand(subcmd string) {
|
||||
|
||||
Reference in New Issue
Block a user