mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-15 07:00:52 +00:00
124 lines
3.7 KiB
Diff
124 lines
3.7 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
|
|
|
|
Forwarded: not-needed
|
|
---
|
|
api/router.go | 22 +++++++++++-----------
|
|
docs/index.go | 10 ----------
|
|
docs/index.go.disabled | 10 ++++++++++
|
|
man/aptly.1 | 3 ++-
|
|
man/aptly.1.ronn.tmpl | 3 ++-
|
|
5 files changed, 25 insertions(+), 23 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 3cd7d42..cf53cd2 100644
|
|
--- a/api/router.go
|
|
+++ b/api/router.go
|
|
@@ -11,9 +11,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
|
|
@@ -63,14 +63,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
|
|
diff --git a/man/aptly.1 b/man/aptly.1
|
|
index bd6ad22..11ed990 100644
|
|
--- a/man/aptly.1
|
|
+++ b/man/aptly.1
|
|
@@ -111,8 +111,9 @@ The legacy json configuration is still supported (and also supports comments):
|
|
// Enable metrics for Prometheus client
|
|
"enableMetricsEndpoint": false,
|
|
|
|
+ // Not implemented in this version\.
|
|
// Enable API documentation on /docs
|
|
- "enableSwaggerEndpoint": false,
|
|
+ //"enableSwaggerEndpoint": false,
|
|
|
|
// OBSOLETE: use via url param ?_async=true
|
|
"AsyncAPI": false,
|
|
diff --git a/man/aptly.1.ronn.tmpl b/man/aptly.1.ronn.tmpl
|
|
index 203cc7f..ed2c87c 100644
|
|
--- a/man/aptly.1.ronn.tmpl
|
|
+++ b/man/aptly.1.ronn.tmpl
|
|
@@ -100,8 +100,9 @@ The legacy json configuration is still supported (and also supports comments):
|
|
// Enable metrics for Prometheus client
|
|
"enableMetricsEndpoint": false,
|
|
|
|
+ // Not implemented in this version.
|
|
// Enable API documentation on /docs
|
|
- "enableSwaggerEndpoint": false,
|
|
+ //"enableSwaggerEndpoint": false,
|
|
|
|
// OBSOLETE: use via url param ?_async=true
|
|
"AsyncAPI": false,
|