feat(tenant-api): expose Swagger UI in non-release mode

Adds an in-process Swagger UI and OpenAPI JSON under /swagger,
registered automatically when the Gin mode is not release. The
admin-web Vite dev server and production nginx config now proxy
/swagger to the tenant API so the docs are reachable from the
existing admin host.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 23:19:31 +08:00
parent a49ac32aa8
commit 461f186337
5 changed files with 673 additions and 0 deletions
@@ -4,6 +4,7 @@ import (
"github.com/geo-platform/tenant-api/internal/bootstrap"
"github.com/geo-platform/tenant-api/internal/shared/auth"
"github.com/geo-platform/tenant-api/internal/shared/middleware"
"github.com/geo-platform/tenant-api/internal/shared/swagger"
"github.com/geo-platform/tenant-api/internal/tenant/repository"
)
@@ -245,4 +246,11 @@ func RegisterRoutes(app *bootstrap.App) {
imageFolders.PUT("/:id", imgHandler.UpdateFolder)
imageFolders.GET("/:id/delete-preview", imgHandler.FolderDeletePreview)
imageFolders.DELETE("/:id", imgHandler.DeleteFolder)
if swagger.EnabledForMode(app.Config.Server.Mode) {
swagger.Register(app.Engine, swagger.Config{
Title: "Geo Rankly Admin API",
Version: "dev",
})
}
}