A webhook server
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
trivernis 970210e420
Add README and LICENSE
Signed-off-by: trivernis <trivernis@protonmail.com>
3 years ago
.idea Add server implementation 3 years ago
src Add lock for parallel runs and detached mode 3 years ago
.gitignore Add server implementation 3 years ago
Cargo.lock Add jsonpath placeholder support 3 years ago
Cargo.toml Add README and LICENSE 3 years ago
LICENSE Add README and LICENSE 3 years ago
README.md Add README and LICENSE 3 years ago

README.md

Multihook

Multihook is an easy to configure webhook server.

Installation

With cargo:

cargo install multihook

Usage

Just run it via systemd or smth.

multihook

Config

The config allows you to configure actions for each endpoint. The config is most likely stored in ~/.config/multihook and on Windows maybe in the APPDATA directory (?). After running the program for the first time there should be a default-config.toml file.

[server]
address = '127.0.0.1:8080'

# the name needs to be unique
[endpoints.ls]
# the path needs to be unique
path = "path/on/the/server"
# a command or a path to the script
action = "ls {{$.filepath}}"
# allows multiple instances of this action to run concurrently
allow_parallel = true

[endpoints.error]
path = "error"
action = "echo '{{$.books.*.title}}'"

[endpoints.testscript]
path = "script"
action = "/home/trivernis/.local/share/multihook/test-script.sh"
allow_parallel = false
# doesn't wait for the command to finish and returns a http response directly
# This setting can be useful if your action takes a very long time to run and would
# cause a timeout
run_detached = true

The configured action is either a script file or a command. In both cases placeholders with the syntax {{query}} can be used. The query is the path to required values in the json body of the request. The request body will also be provided in the environment variable HOOK_BODY.

License

GPL-3