add possibility to specify HTTPS as default scheme in the swagger UI

see #639
This commit is contained in:
Bernhard B
2025-01-06 22:29:55 +01:00
parent 3752538e9b
commit 3914178ec7
2 changed files with 7 additions and 1 deletions

View File

@@ -138,4 +138,6 @@ There are a bunch of environmental variables that can be set inside the docker c
* `SWAGGER_IP`: The IP that's used in the Swagger UI for the interactive examples. Defaults to the container ip.
* `SWAGGER_USE_HTTPS_AS_PREFERRED_SCHEME`: Use the HTTPS Scheme as preferred scheme in the Swagger UI.
* `PORT`: Defaults to port `8080` unless this env var is set to tell it otherwise.

View File

@@ -77,7 +77,11 @@ func main() {
avatarTmpDir := flag.String("avatar-tmp-dir", "/tmp/", "Avatar tmp directory")
flag.Parse()
docs.SwaggerInfo.Schemes = []string{"http", "https"}
if utils.GetEnv("SWAGGER_USE_HTTPS_AS_PREFERRED_SCHEME", "false") == "false" {
docs.SwaggerInfo.Schemes = []string{"http", "https"}
} else {
docs.SwaggerInfo.Schemes = []string{"https", "http"}
}
router := gin.New()
router.Use(gin.LoggerWithConfig(gin.LoggerConfig{