diff --git a/DOCS.md b/DOCS.md index f8c9f8d..8cbab99 100644 --- a/DOCS.md +++ b/DOCS.md @@ -1,10 +1,12 @@ Use the Webhook plugin to notify services via Webhook when a build completes. -You will need to supply Drone with outgoing Webhook URLs. You can override the -default configuration with the following parameters: +You will need to supply Drone with outgoing Webhook URLs. + +You can override the default configuration with the following parameters: * `urls` - JSON payloads are sent to each URL * `method` - HTTP request method. Defaults to `POST` * `header` - HTTP request header map +* `skip_verify` - Skip verification of TLS certificates, defaults to `false` ## Example @@ -23,10 +25,10 @@ notify: ### Custom Body In some cases you may want to submit a custom payload in the body of your hook. -For the use case we expose the following additional parameters: +For this usage the following additional parameters should be used: * `template` - Handlebars template to create a custom payload body. See [docs](http://handlebarsjs.com/) -* `content_type` - HTTP request content type +* `content_type` - HTTP request content type, defaults to `application/json` Example configuration that generate a custom Yaml payload: diff --git a/main.go b/main.go index d861248..5c8dd23 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "crypto/tls" "encoding/json" "fmt" "io/ioutil" @@ -108,7 +109,15 @@ func main() { req.SetBasicAuth(vargs.Auth.Username, vargs.Auth.Password) } - resp, err := http.DefaultClient.Do(req) + client := http.DefaultClient + if vargs.SkipVerify { + client = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + } + resp, err := client.Do(req) if err != nil { fmt.Printf("Error: Failed to execute the HTTP request. %s\n", err) diff --git a/types.go b/types.go index 3b56224..a5a8682 100644 --- a/types.go +++ b/types.go @@ -3,6 +3,7 @@ package main // Params represents the valid paramenter options for the webhook plugin. type Params struct { URLs []string `json:"urls"` + SkipVerify bool `json:"skip_verify"` Debug bool `json:"debug"` Auth Auth `json:"auth"` Headers map[string]string `json:"header"`