diff --git a/README.md b/README.md index c567c08..75b344d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/main.go b/src/main.go index e22e3a4..b5f3510 100644 --- a/src/main.go +++ b/src/main.go @@ -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{