#webhook #server #systemd

app multihook

一个webhook服务器

11个不稳定版本 (3个破坏性)

0.4.2 2023年6月17日
0.4.1 2023年6月17日
0.3.0 2023年6月17日
0.2.0 2023年6月17日
0.1.5 2021年8月8日

#19 in #webhook

Download history 4/week @ 2024-03-09 54/week @ 2024-03-30 12/week @ 2024-04-06

每月下载量 66次

GPL-3.0 许可证

31KB
671

多钩子

多钩子是一个易于配置的webhook服务器。

安装

使用cargo

cargo install multihook

用法

只需通过systemd或类似方式运行它。

multihook

配置

该配置允许您为每个端点配置操作。配置文件很可能存储在 ~/.config/multihook 中,在Windows中可能在APPDATA目录中(?)。第一次运行程序后,应该创建配置目录和配置文件。

[server]
address = '127.0.0.1:8080'

[hooks]
# executed before all endpoint actions
pre_action = "echo 'pre action'"
# executed after all endpoint actions
post_action = "echo 'post action'"
# executed when an action fails
err_action = "echo \"Hook $HOOK_NAME failed with error: $HOOK_ERROR\""

# 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
# additional hooks on endpoint-level
hooks = {pre_action = "echo 'before something bad happens'"}

[endpoints.error]
path = "error"
action = "echo '{{$.books.*.title}}'"
# Validate secrets according to different parsing rules
# Currently only HMac based secrets with sha256 are supported
secret = { value = "my secret", format = "HMac"}

[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

配置的 操作 是一个脚本文件或命令。在这两种情况下,可以使用具有 {{query}} 语法占位符。查询是请求json体中所需值的路径。请求体也将以环境变量 HOOK_BODY 提供的。

许可证

GPL-3

依赖关系

~17–31MB
~437K SLoC