From 60c395d4a86cefefa1ac2b535d255a28869e6635 Mon Sep 17 00:00:00 2001 From: Bernhard B Date: Mon, 14 Apr 2025 22:47:56 +0200 Subject: [PATCH] fixed bug in swagger documentation * use configured SWAGGER_HOST env variable when generating the URL for the swagger documentation file. see #683 --- src/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.go b/src/main.go index e1dd09e..57f85a1 100644 --- a/src/main.go +++ b/src/main.go @@ -335,7 +335,12 @@ func main() { } } - swaggerUrl := ginSwagger.URL("http://" + swaggerIp + ":" + string(port) + "/swagger/doc.json") + protocol := "http" + if utils.GetEnv("SWAGGER_USE_HTTPS_AS_PREFERRED_SCHEME", "false") == "true" { + protocol = "https" + } + + swaggerUrl := ginSwagger.URL(protocol + "://" + swaggerHost + "/swagger/doc.json") router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, swaggerUrl)) autoReceiveSchedule := utils.GetEnv("AUTO_RECEIVE_SCHEDULE", "")