psu/common/connection.go
Juan Carlos Mejías Rodríguez c5b1dfaa82 Rewrite project in Go
2019-07-21 18:49:28 -04:00

23 lines
365 B
Go

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"),
}
}