fix(config): remove duplicate API_HOST and strip protocol prefix in main.go
This commit is contained in:
parent
0a69406b31
commit
52f31710cf
2 changed files with 5 additions and 1 deletions
|
|
@ -42,4 +42,3 @@ CLOUDFLARE_ZONE_ID=your-zone-id
|
||||||
CPANEL_HOST=https://cpanel.yourdomain.com:2083
|
CPANEL_HOST=https://cpanel.yourdomain.com:2083
|
||||||
CPANEL_USERNAME=your-cpanel-username
|
CPANEL_USERNAME=your-cpanel-username
|
||||||
CPANEL_API_TOKEN=your-cpanel-api-token
|
CPANEL_API_TOKEN=your-cpanel-api-token
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"github.com/rede5/gohorsejobs/backend/docs"
|
"github.com/rede5/gohorsejobs/backend/docs"
|
||||||
|
|
@ -38,6 +39,10 @@ func main() {
|
||||||
if apiHost == "" {
|
if apiHost == "" {
|
||||||
apiHost = "localhost:8521"
|
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.Host = apiHost
|
||||||
docs.SwaggerInfo.Schemes = []string{"http", "https"}
|
docs.SwaggerInfo.Schemes = []string{"http", "https"}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue