psu/common/connection.go

23 lines
365 B
Go
Raw Normal View History

2019-07-21 02:00:04 +00:00
package common
import (
"crypto/tls"
"github.com/spf13/viper"
"net/http"
)
func NewHttpClient() http.Client {
// Create HTTP transport
tr := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: viper.GetBool("insecure"),
},
}
// Create HTTP client
return http.Client{
Transport: tr,
Timeout: viper.GetDuration("timeout"),
}
}