mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-30 01:02:29 +00:00
parent
0f4bbfac9f
commit
d279505930
4 changed files with 22 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
|||
# Hook definition
|
||||
Hooks are defined as JSON objects. Please note that in order to be considered valid, a hook object must contain the `id` and `execute-command` properties. All other properties are considered optional.
|
||||
|
||||
Hooks are defined as objects in the JSON or YAML hooks configuration file. Please note that in order to be considered valid, a hook object must contain the `id` and `execute-command` properties. All other properties are considered optional.
|
||||
|
||||
## Properties (keys)
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Hook examples
|
||||
This page is still work in progress. Feel free to contribute!
|
||||
# Hook Examples
|
||||
|
||||
Hooks are defined in a hooks configuration file in either JSON or YAML format,
|
||||
although the examples on this page all use the JSON format.
|
||||
|
||||
🌱 This page is still a work in progress. Feel free to contribute!
|
||||
|
||||
### Table of Contents
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# Templates in Webhook
|
||||
|
||||
[`webhook`][w] can parse the `hooks.json` input file as a Go template when given the `-template` [CLI parameter](Webhook-Parameters.md).
|
||||
[`webhook`][w] can parse a hooks configuration file as a Go template when given the `-template` [CLI parameter](Webhook-Parameters.md).
|
||||
|
||||
In additional to the [built-in Go template functions and features][tt], `webhook` provides a `getenv` template function for inserting environment variables into a `hooks.json` file.
|
||||
In additional to the [built-in Go template functions and features][tt], `webhook` provides a `getenv` template function for inserting environment variables into a templated configuration file.
|
||||
|
||||
## Example Usage
|
||||
|
||||
In the example `hooks.json` file below, the `payload-hmac-sha1` matching rule looks up the HMAC secret from the environment using the `getenv` template function.
|
||||
In the example JSON template file below (YAML is also supported), the `payload-hmac-sha1` matching rule looks up the HMAC secret from the environment using the `getenv` template function.
|
||||
Additionally, the result is piped through the built-in Go template function `js` to ensure that the result is a well-formed Javascript/JSON string.
|
||||
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue