From 893ba089d07b09ec0d572d25c3dbfddde5b24aa3 Mon Sep 17 00:00:00 2001 From: Yunkon Kim Date: Mon, 1 Apr 2024 16:39:48 +0900 Subject: [PATCH 1/2] Update the URL to access Swagger UI --- src/api/rest/server/server.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/api/rest/server/server.go b/src/api/rest/server/server.go index b9a6ab76f..cd6e6bf95 100644 --- a/src/api/rest/server/server.go +++ b/src/api/rest/server/server.go @@ -108,7 +108,14 @@ func RunServer(port string) { //e.colorer.Printf(banner, e.colorer.Red("v"+Version), e.colorer.Blue(website)) // Route for system management - e.GET("/tumblebug/swagger/*", echoSwagger.WrapHandler) + swaggerRedirect := func(c echo.Context) error { + return c.Redirect(http.StatusMovedPermanently, "/tumblebug/api/index.html") + } + e.GET("/tumblebug/api", swaggerRedirect) + e.GET("/tumblebug/api/", swaggerRedirect) + e.GET("/tumblebug/api/*", echoSwagger.WrapHandler) + + // e.GET("/tumblebug/swagger/*", echoSwagger.WrapHandler) // e.GET("/tumblebug/swaggerActive", rest_common.RestGetSwagger) e.GET("/tumblebug/health", rest_common.RestGetHealth) e.GET("/tumblebug/httpVersion", rest_common.RestCheckHTTPVersion) @@ -421,7 +428,7 @@ func RunServer(port string) { g.GET("/:nsId/testGetAssociatedObjectCount/:resourceType/:resourceId", rest_mcir.RestTestGetAssociatedObjectCount) selfEndpoint := os.Getenv("SELF_ENDPOINT") - apidashboard := " http://" + selfEndpoint + "/tumblebug/swagger/" + apidashboard := " http://" + selfEndpoint + "/tumblebug/api/index.html" if enableAuth { fmt.Println(" Access to API dashboard" + " (username: " + apiUser + " / password: " + apiPass + ")") From 37356e56a9cc30501944e9b33c3c747da6ca9e99 Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Mon, 1 Apr 2024 17:02:29 +0900 Subject: [PATCH 2/2] Provide simple swagger api dashboard path startup --- src/api/rest/server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/rest/server/server.go b/src/api/rest/server/server.go index cd6e6bf95..d78bef3b6 100644 --- a/src/api/rest/server/server.go +++ b/src/api/rest/server/server.go @@ -428,7 +428,7 @@ func RunServer(port string) { g.GET("/:nsId/testGetAssociatedObjectCount/:resourceType/:resourceId", rest_mcir.RestTestGetAssociatedObjectCount) selfEndpoint := os.Getenv("SELF_ENDPOINT") - apidashboard := " http://" + selfEndpoint + "/tumblebug/api/index.html" + apidashboard := " http://" + selfEndpoint + "/tumblebug/api" if enableAuth { fmt.Println(" Access to API dashboard" + " (username: " + apiUser + " / password: " + apiPass + ")")