This commit is contained in:
Joachim Hill-Grannec
2017-09-01 10:49:41 -04:00
parent dbc5015833
commit cfb46f2f1e
2 changed files with 48 additions and 48 deletions
+25 -24
View File
@@ -2,15 +2,16 @@ package main
import (
"fmt"
"os"
"log"
"github.com/urfave/cli"
"log"
"os"
)
const (
respFormat = "Webhook %d\n URL: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n"
debugRespFormat = "Webhook %d\n URL: %s\n METHOD: %s\n HEADERS: %s\n REQUEST BODY: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n"
)
var build string
func main() {
@@ -27,13 +28,13 @@ func main() {
Value: "POST",
},
cli.StringFlag{
Name: "username",
Usage: "Username for basic auth",
Name: "username",
Usage: "Username for basic auth",
EnvVar: "PLUGIN_USERNAME,WEBHOOK_USERNAME",
},
cli.StringFlag{
Name: "password",
Usage: "Password for basic auth",
Name: "password",
Usage: "Password for basic auth",
EnvVar: "PLUGIN_PASSWORD,WEBHOOK_PASSWORD",
},
cli.StringFlag{
@@ -43,28 +44,28 @@ func main() {
Value: "application/json",
},
cli.StringFlag{
Name: "template",
Usage: "Custom template for webhook",
Name: "template",
Usage: "Custom template for webhook",
EnvVar: "PLUGIN_TEMPLATE",
},
cli.StringSliceFlag{
Name: "headers",
Usage: "Custom headers key map",
Name: "headers",
Usage: "Custom headers key map",
EnvVar: "PLUGIN_HEADERS",
},
cli.StringSliceFlag{
Name: "urls",
Usage: "List of urls to perform the action on",
Name: "urls",
Usage: "List of urls to perform the action on",
EnvVar: "PLUGIN_URLS",
},
cli.BoolFlag{
Name: "debug",
Usage: "For debug information",
Name: "debug",
Usage: "For debug information",
EnvVar: "PLUGIN_DEBUG",
},
cli.BoolFlag{
Name: "skip-verify",
Usage: "Skip ssl verification",
Name: "skip-verify",
Usage: "Skip ssl verification",
EnvVar: "PLUGIN_SKIP_VERIFY",
},
cli.StringFlag{
@@ -182,15 +183,15 @@ func run(c *cli.Context) error {
Started: c.Int64("job.started"),
},
Config: Config{
Method: c.String("method"),
Username: c.String("username"),
Password: c.String("password"),
Method: c.String("method"),
Username: c.String("username"),
Password: c.String("password"),
ContentType: c.String("content-type"),
Template: c.String("template"),
Headers: c.StringSlice("headers"),
URLs: c.StringSlice("urls"),
Debug: c.Bool("debug"),
SkipVerify: c.Bool("skip-verify"),
Template: c.String("template"),
Headers: c.StringSlice("headers"),
URLs: c.StringSlice("urls"),
Debug: c.Bool("debug"),
SkipVerify: c.Bool("skip-verify"),
},
}
return plugin.Exec()