Hooks
The hooks feature allows the user to configure a list of hook functions which are triggered by certain events within the daemon.
Configuration
Section "hooks" of /etc/cunicu.yaml
## Hook callbacks
#
# Hook callback can be used to invoke subprocesses
# or web-hooks on certain events within cunīcu.
hooks:
# An 'exec' hook spawn a subprocess for each event.
- type: exec
command: ../../scripts/hook.sh
# Prepend additional arguments
args: []
# Pass JSON object via Stdin to command
stdin: true
# Set environment variables for invocation
env:
COLOR: "1"
# A 'web' hook performs HTTP requests for each event.
- type: web
# URL of the webhook endpoint
url: https://my-webhook-endpoint.com/api/v1/webhook
# HTTP method of the request
method: POST
# Additional HTTP headers which are used for the requests
headers:
User-Agent: ahoi
Authorization: Bearer XXXXXX