1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Close #152 add option to skip verification of jira server's certificate chain and hostname

This commit is contained in:
Anand Sudhir Prayaga 2018-06-14 15:59:00 +02:00
parent 2833ec843c
commit 3a519c4910
2 changed files with 14 additions and 1 deletions

View File

@ -43,6 +43,7 @@ jira:
project: "JIRA" project: "JIRA"
refreshInterval: 900 refreshInterval: 900
username: "chris.cummer" username: "chris.cummer"
verifyServerCertificate: true
``` ```
### Attributes ### Attributes
@ -86,3 +87,8 @@ Values: A positive integer, `0..n`.
`username` <br /> `username` <br />
Your Jira username. <br /> Your Jira username. <br />
`verifyServerCertificate` <br />
_Optional_ <br />
Determines whether or not the server's certificate chain and host name are verified. <br />
Values: `true`, `false`.

View File

@ -2,6 +2,7 @@ package jira
import ( import (
"bytes" "bytes"
"crypto/tls"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
@ -59,7 +60,13 @@ func jiraRequest(path string) (*http.Response, error) {
} }
req.SetBasicAuth(Config.UString("wtf.mods.jira.email"), os.Getenv("WTF_JIRA_API_KEY")) req.SetBasicAuth(Config.UString("wtf.mods.jira.email"), os.Getenv("WTF_JIRA_API_KEY"))
httpClient := &http.Client{} verifyServerCertificate := Config.UBool("wtf.mods.jira.verifyServerCertificate", true)
httpClient := &http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: !verifyServerCertificate,
},
},
}
resp, err := httpClient.Do(req) resp, err := httpClient.Do(req)
if err != nil { if err != nil {
return nil, err return nil, err