mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
add option to skip verification of jenkins server's certificate chain and hostname
This commit is contained in:
@@ -2,12 +2,15 @@ package jenkins
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
func Create(jenkinsURL string, username string, apiKey string) (*View, error) {
|
||||
@@ -26,7 +29,13 @@ func Create(jenkinsURL string, username string, apiKey string) (*View, error) {
|
||||
req, _ := http.NewRequest("GET", jenkinsAPIURL.String(), nil)
|
||||
req.SetBasicAuth(username, apiKey)
|
||||
|
||||
httpClient := &http.Client{}
|
||||
verifyServerCertificate := wtf.Config.UBool("wtf.mods.jenkins.verifyServerCertificate", true)
|
||||
httpClient := &http.Client{Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
InsecureSkipVerify: !verifyServerCertificate,
|
||||
},
|
||||
},
|
||||
}
|
||||
resp, err := httpClient.Do(req)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user