webhook

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

webhook

A simple webhook server. Run scripts whenever webhook is triggered.

Usage

Usage:
  webhook [OPTIONS]

Application Options:
  -a, --addr=     Address to listen on (default: :8080)
  -f, --file=     Path to the toml file containing hooks definition
      --pid=      Create PID file at the given path
      --tls       Activate https instead of http
      --tls-key=  Path to the private key pem file for HTTPS
      --tls-cert= Path to the certificate pem file for HTTPS

Help Options:
  -h, --help      Show this help message

Define some hooks you want to serve in hooks.toml.

[[hooks]]
name = 'sample'
command = '/path/to/script.sh'

Run webhook as below:

$ webhook --file hooks.toml
2022/08/01 21:00:00 Loaded 'sample' hook
2022/08/01 21:00:00 Listening on :8080

It will start up webhook service with HTTP endpoint http://localhost:8080/sample. Then you can execute the script using POST request:

$ cat input.json | curl -X POST --data-binary @- http://localhost:8080/sample

Data in POST request will be passed to the script as stdin. The output result will be displayed.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL