More idiomatic use of building urls using url.URL
authorSofian Brabez <sbz@6dev.net>
Thu, 26 Jul 2018 14:23:41 +0000 (15:23 +0100)
committerSofian Brabez <sbz@6dev.net>
Thu, 26 Jul 2018 14:23:41 +0000 (15:23 +0100)
vault.go

index 4c212e7683d7f8f8134b53aae450bf7d3b3fb597..a7fbd3005140e94e7361994eeff4f5370edb5705 100644 (file)
--- a/vault.go
+++ b/vault.go
@@ -5,6 +5,7 @@ import (
        "fmt"
        "io/ioutil"
        "net/http"
+       "net/url"
 
        log "github.com/sirupsen/logrus"
 )
@@ -58,8 +59,8 @@ func (v *Vault) CheckCluster() (bool, error) {
        }
 
        for _, nodeIp := range vaultNodeIps {
-               healthURL := "https://" + nodeIp + ":8200" + HealthEndpointURL
-               if sealed, err := isSealed(healthURL); sealed {
+               healthURL := url.URL{Scheme: "https", Host: nodeIp + ":8200", Path: HealthEndpointURL}
+               if sealed, err := isSealed(healthURL.String()); sealed {
                        return false, err
                }
        }