Use cleanhttp instead of bare http.Client

This commit is contained in:
Jeff Mitchell
2015-10-22 14:37:12 -04:00
parent 6c4e05dbc0
commit 5c0a16b16a
6 changed files with 17 additions and 14 deletions

View File

@@ -9,6 +9,8 @@ import (
"strings"
"sync"
"time"
"github.com/hashicorp/go-cleanhttp"
)
var (
@@ -38,10 +40,10 @@ type Config struct {
func DefaultConfig() *Config {
config := &Config{
Address: "https://127.0.0.1:8200",
HttpClient: &http.Client{
Timeout: time.Second * 60,
},
HttpClient: cleanhttp.DefaultClient(),
}
config.HttpClient.Timeout = time.Second * 60
if addr := os.Getenv("VAULT_ADDR"); addr != "" {
config.Address = addr