Added host URL normalization
Build Docker image on push / docker (push) Successful in 22s
Build and push Docker image on tag / docker (push) Successful in 23s

This commit is contained in:
2026-08-17 23:04:28 +02:00
parent 462eb4f80c
commit 6e3bb0ff7b
4 changed files with 92 additions and 1 deletions
+7 -1
View File
@@ -7,6 +7,7 @@ import (
"fmt"
"net"
"net/http"
"strings"
"sync"
"time"
@@ -55,7 +56,7 @@ func NewApiClient(endpoints []string, tokenId string, secret string, checkInterv
// Prepare API endpoints.
for _, endpoint := range endpoints {
apiEndpoint := ApiEndpoint{
host: endpoint,
host: normalizeApiHost(endpoint),
alive: false,
}
instance.endpoints = append(instance.endpoints, &apiEndpoint)
@@ -86,6 +87,11 @@ func NewApiClient(endpoints []string, tokenId string, secret string, checkInterv
return &instance
}
// normalizeApiHost ensures API paths can be appended to either IP- or DNS-based hosts.
func normalizeApiHost(host string) string {
return strings.TrimRight(strings.TrimSpace(host), "/") + "/"
}
// Check endpoint liveness state.
func (instance *ApiClient) checkEndpointsLiveness() {
// We want to make sure other routines won't make any requests until we have checked for alive connections.