Files
aptly/debian/patches/0001-disable-swagger.patch
T
Sébastien Delafond 237f43f8ba Rediff patches
Add 0002-disable-new-azure-sdk.patch: <REASON>
Drop 0002-Disable-new-azure-sdk.patch: <REASON>
2024-12-11 18:16:03 +01:00

90 lines
2.6 KiB
Diff

From: =?utf-8?q?Andr=C3=A9_Roth?= <neolynx@gmail.com>
Date: Tue, 15 Oct 2024 12:09:33 +0200
Subject: Disable swagger
This can be enabled once the following modules make it into Debian:
- github.com/swaggo/files v1.0.1
- github.com/swaggo/gin-swagger v1.6.0
- github.com/swaggo/swag v1.16.3
---
api/router.go | 22 +++++++++++-----------
docs/index.go | 10 ----------
docs/index.go.disabled | 10 ++++++++++
3 files changed, 21 insertions(+), 21 deletions(-)
delete mode 100644 docs/index.go
create mode 100644 docs/index.go.disabled
diff --git a/api/router.go b/api/router.go
index 3536ab0..7dbf16e 100644
--- a/api/router.go
+++ b/api/router.go
@@ -12,9 +12,9 @@
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/zerolog/log"
- "github.com/aptly-dev/aptly/docs"
- swaggerFiles "github.com/swaggo/files"
- ginSwagger "github.com/swaggo/gin-swagger"
+ // _ "github.com/aptly-dev/aptly/docs" // import docs
+ // swaggerFiles "github.com/swaggo/files"
+ // ginSwagger "github.com/swaggo/gin-swagger"
)
var context *ctx.AptlyContext
@@ -68,14 +68,14 @@ func Router(c *ctx.AptlyContext) http.Handler {
router.Use(gin.Recovery(), gin.ErrorLogger())
- if c.Config().EnableSwaggerEndpoint {
- router.GET("docs.html", func(c *gin.Context) {
- c.Data(http.StatusOK, "text/html; charset=utf-8", docs.DocsHTML)
- })
- router.Use(redirectSwagger)
- url := ginSwagger.URL("/docs/doc.json")
- router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
- }
+ // if c.Config().EnableSwaggerEndpoint {
+ // router.GET("docs.html", func(c *gin.Context) {
+ // c.Data(http.StatusOK, "text/html; charset=utf-8", docs.DocsHTML)
+ // })
+ // router.Use(redirectSwagger)
+ // url := ginSwagger.URL("/docs/doc.json")
+ // router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
+ // }
if c.Config().EnableMetricsEndpoint {
MetricsCollectorRegistrar.Register(router)
diff --git a/docs/index.go b/docs/index.go
deleted file mode 100644
index ca4c914..0000000
--- a/docs/index.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package docs
-
-import (
- _ "embed" // embed html below
-
- _ "github.com/swaggo/swag" // make sure swag is in go.mod
-)
-
-//go:embed docs.html
-var DocsHTML []byte
diff --git a/docs/index.go.disabled b/docs/index.go.disabled
new file mode 100644
index 0000000..ca4c914
--- /dev/null
+++ b/docs/index.go.disabled
@@ -0,0 +1,10 @@
+package docs
+
+import (
+ _ "embed" // embed html below
+
+ _ "github.com/swaggo/swag" // make sure swag is in go.mod
+)
+
+//go:embed docs.html
+var DocsHTML []byte