fixed bug in swagger documentation

* use configured SWAGGER_HOST env variable when generating
  the URL for the swagger documentation file.

see #683
This commit is contained in:
Bernhard B
2025-04-14 22:47:56 +02:00
parent 85c308302c
commit 60c395d4a8

View File

@@ -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", "")