mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
23 lines
365 B
Go
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"),
|
|
}
|
|
}
|