mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-19 04:33:28 +02:00
Merge pull request #27 from blalor/insecure-skip-verify
Add insecure option for TLS endpoints
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"net/http"
|
||||
"net/http/cookiejar"
|
||||
"net/url"
|
||||
"crypto/tls"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
@@ -36,15 +37,26 @@ func New(opts map[string]interface{}) *Cli {
|
||||
endpoint, _ := opts["endpoint"].(string)
|
||||
url, _ := url.Parse(strings.TrimRight(endpoint, "/"))
|
||||
|
||||
transport := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{},
|
||||
}
|
||||
|
||||
if project, ok := opts["project"].(string); ok {
|
||||
opts["project"] = strings.ToUpper(project)
|
||||
}
|
||||
|
||||
if insecureSkipVerify, ok := opts["insecure"].(bool); ok {
|
||||
transport.TLSClientConfig.InsecureSkipVerify = insecureSkipVerify
|
||||
}
|
||||
|
||||
cli := &Cli{
|
||||
endpoint: url,
|
||||
opts: opts,
|
||||
cookieFile: fmt.Sprintf("%s/.jira.d/cookies.js", homedir),
|
||||
ua: &http.Client{Jar: cookieJar},
|
||||
ua: &http.Client{
|
||||
Jar: cookieJar,
|
||||
Transport: transport,
|
||||
},
|
||||
}
|
||||
|
||||
cli.ua.Jar.SetCookies(url, cli.loadCookies())
|
||||
|
||||
@@ -84,6 +84,7 @@ Usage:
|
||||
General Options:
|
||||
-b --browse Open your browser to the Jira issue
|
||||
-e --endpoint=URI URI to use for jira
|
||||
-k --insecure disable TLS certificate verification
|
||||
-h --help Show this usage
|
||||
-t --template=FILE Template file to use for output/editing
|
||||
-u --user=USER Username to use for authenticaion (default: %s)
|
||||
@@ -185,6 +186,7 @@ Command Options:
|
||||
"editor=s": setopt,
|
||||
"u|user=s": setopt,
|
||||
"endpoint=s": setopt,
|
||||
"k|insecure": setopt,
|
||||
"t|template=s": setopt,
|
||||
"q|query=s": setopt,
|
||||
"p|project=s": setopt,
|
||||
|
||||
Reference in New Issue
Block a user