fix(config): remove duplicate API_HOST and strip protocol prefix in main.go

This commit is contained in:
Tiago Yamamoto 2025-12-15 11:08:18 -03:00
parent 0a69406b31
commit 52f31710cf
2 changed files with 5 additions and 1 deletions

View file

@ -42,4 +42,3 @@ CLOUDFLARE_ZONE_ID=your-zone-id
CPANEL_HOST=https://cpanel.yourdomain.com:2083
CPANEL_USERNAME=your-cpanel-username
CPANEL_API_TOKEN=your-cpanel-api-token

View file

@ -4,6 +4,7 @@ import (
"log"
"net/http"
"os"
"strings"
"github.com/joho/godotenv"
"github.com/rede5/gohorsejobs/backend/docs"
@ -38,6 +39,10 @@ func main() {
if apiHost == "" {
apiHost = "localhost:8521"
}
// Strip protocol schemes if present 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"}