2021-03-12 16:46:47 +01:00
|
|
|
# Webhookey
|
2021-03-21 15:51:58 +01:00
|
|
|
Webhookey is a webserver listening for requests as for example sent by
|
|
|
|
gitea's webhooks. Further, Webhookey allows you to specifiy rules
|
|
|
|
which are matched against the data received to trigger certain
|
|
|
|
actions.
|
2021-03-12 16:46:47 +01:00
|
|
|
|
|
|
|
## Build
|
|
|
|
|
|
|
|
### Install Rust
|
|
|
|
The Rust toolchain needs to be installed:
|
|
|
|
``` sh
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
```
|
|
|
|
|
|
|
|
Further, for Rocket we need to have the nightly toolchain installed:
|
|
|
|
``` sh
|
|
|
|
rustup toolchain install nightly
|
|
|
|
```
|
|
|
|
|
|
|
|
### Build Webhookey
|
|
|
|
The webhookey project can be built for development:
|
|
|
|
``` sh
|
|
|
|
cargo b
|
|
|
|
```
|
|
|
|
|
|
|
|
or for releasing:
|
|
|
|
``` sh
|
|
|
|
cargo b --release
|
|
|
|
```
|
|
|
|
|
|
|
|
### Install Webhookey
|
|
|
|
When a Rust toolchain installed you can also install Webhookey
|
|
|
|
directly without cloning it manualy:
|
|
|
|
``` sh
|
|
|
|
cargo install --git https://git.onders.org/finga/webhookey.git webhookey
|
|
|
|
```
|
|
|
|
|
|
|
|
or from within the project:
|
|
|
|
``` sh
|
|
|
|
cargo install webhookey
|
|
|
|
```
|
|
|
|
|
|
|
|
### Run Webhookey
|
|
|
|
Webhookey can either be run from the project directory with:
|
|
|
|
``` sh
|
|
|
|
cargo b
|
|
|
|
```
|
|
|
|
|
|
|
|
or you can copy the produced binary somewhere else from
|
|
|
|
`webhookey/target/{debug, release}/webhookey` depending on which one
|
|
|
|
you built.
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
Configuration syntax is YAML and has to be done in following order:
|
|
|
|
|
|
|
|
Right now there is only the configuration parameter for hooks, here
|
|
|
|
each hook has to be configured, It contains following fields:
|
2021-03-21 15:51:58 +01:00
|
|
|
- command: Optional string for a command to be executed when all
|
|
|
|
filters match. Pointers ([RFC
|
|
|
|
6901](https://tools.ietf.org/html/rfc6901)) to JSON fields may be
|
|
|
|
used to be replaced with data from the JSON data with `{{
|
|
|
|
/field/pointed/to }}`
|
|
|
|
- secrets: List of secrets.
|
|
|
|
- filters: List of filters.
|
|
|
|
|
|
|
|
Each filter must have following fields:
|
2021-03-12 16:46:47 +01:00
|
|
|
- pointer: pointer to the JSON field according to [RFC
|
|
|
|
6901](https://tools.ietf.org/html/rfc6901)
|
|
|
|
- regex: regular expression which has to match the field pointed to by
|
|
|
|
the pointer
|
|
|
|
|
|
|
|
### Configuration paths
|
|
|
|
Following locations are checked for a configuration file:
|
|
|
|
- `/etc/webhookey/config.yml`
|
|
|
|
- `<config_dir>/webhookey/config.yml`
|
|
|
|
- `./config.yml`
|
|
|
|
|
|
|
|
Whereas `<config_dir>` depends on the platform:
|
|
|
|
- Linux: `$XDG_CONFIG_HOME` or `$HOME/.config`
|
|
|
|
- macOS: `$HOME/Library/Application Support`
|
|
|
|
- Windows: `{FOLDERID_RoamingAppData}`
|
|
|
|
|
|
|
|
# TODOs
|
|
|
|
## Use `lazy_static` or `once_cell` for compiled regexes
|
|
|
|
## Use `clap` to parse command line arguments
|
|
|
|
## Implement the functionality to reply to certain webhooks
|
2021-03-21 23:35:08 +01:00
|
|
|
## Configure rocket via config.yml
|
2021-03-12 16:46:47 +01:00
|
|
|
## Security
|
2021-03-19 14:37:53 +01:00
|
|
|
### https support
|
2021-03-21 23:35:08 +01:00
|
|
|
basically supported, but related to "Configure rocket via config.yml".
|
2021-03-12 16:46:47 +01:00
|
|
|
### Authentication features
|
|
|
|
### Secure cookies?
|
2021-03-21 15:51:58 +01:00
|
|
|
## Use proptest or quickcheck for tests of parsers
|