diff --git a/backend/cmd/api/main.go b/backend/cmd/api/main.go index d332c98..156959a 100755 --- a/backend/cmd/api/main.go +++ b/backend/cmd/api/main.go @@ -39,12 +39,21 @@ func main() { if apiHost == "" { apiHost = "localhost:8521" } - // Strip protocol schemes if present to ensure clean host for Swagger + + // Detect scheme from env var + schemes := []string{"http", "https"} // default to both + if strings.HasPrefix(apiHost, "https://") { + schemes = []string{"https"} + } else if strings.HasPrefix(apiHost, "http://") { + schemes = []string{"http"} + } + + // Strip protocol schemes to ensure clean host for Swagger apiHost = strings.TrimPrefix(apiHost, "http://") apiHost = strings.TrimPrefix(apiHost, "https://") docs.SwaggerInfo.Host = apiHost - docs.SwaggerInfo.Schemes = []string{"http", "https"} + docs.SwaggerInfo.Schemes = schemes handler := router.NewRouter()