2022-10-03 11:53:44 -05:00
|
|
|
//go:build debug
|
|
|
|
// +build debug
|
|
|
|
|
|
|
|
// @contact.name API Support
|
|
|
|
// @contact.url http://www.swagger.io/support
|
|
|
|
// @contact.email support@swagger.io
|
|
|
|
|
|
|
|
package debug
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gorilla/mux"
|
|
|
|
httpSwagger "github.com/swaggo/http-swagger"
|
2022-10-20 11:39:20 -05:00
|
|
|
|
2024-01-31 23:34:07 -05:00
|
|
|
"zotregistry.dev/zot/pkg/api/config"
|
|
|
|
"zotregistry.dev/zot/pkg/log" //nolint:goimports
|
2022-10-03 11:53:44 -05:00
|
|
|
// as required by swaggo.
|
2024-01-31 23:34:07 -05:00
|
|
|
_ "zotregistry.dev/zot/swagger"
|
2022-10-03 11:53:44 -05:00
|
|
|
)
|
|
|
|
|
2023-02-10 17:52:54 -05:00
|
|
|
func SetupSwaggerRoutes(conf *config.Config, router *mux.Router, authFunc mux.MiddlewareFunc,
|
|
|
|
log log.Logger,
|
2022-10-03 11:53:44 -05:00
|
|
|
) {
|
|
|
|
log.Info().Msg("setting up swagger route")
|
2023-04-27 02:09:46 -05:00
|
|
|
// swagger "/swagger/v2/index.html"
|
2023-02-10 17:52:54 -05:00
|
|
|
swgRouter := router.PathPrefix("/swagger/v2/").Subrouter()
|
|
|
|
swgRouter.Use(authFunc)
|
|
|
|
swgRouter.Methods("GET").Handler(httpSwagger.WrapHandler)
|
2022-10-03 11:53:44 -05:00
|
|
|
}
|