In order to keep things together the code was restructured. Some small
improvements such as clippy warnings and the validation of a hook in
regards of the ip filter.
To support command line arguments `clap` is used. This adds following
argument `--config`/`-c` to provide a different path for the
configurationf file and the subcommand `configtest` which parses and
loads the configuration and exits.
The first version `0.1.0-rc.0` and metadata for `cargo-deb` is now in
`Cargo.toml`. For that, the service file as well as the config file
were moved.
For a improved systemd service file the `User` and `Group` is now set
via variables and the log level is now set to `info`. In the previous
version of the service file the parameter for `ExecStart` was missing
which prevented this file from working.
The dependencies in `Cargo.lock` were updated.
To be able to parse other values than
`serde_json::Value::String(String)` we parse the pointer parameters
and replace all those values in the JSON data with strings.
In order to allow or deny sources of requests the possibility to
configure a list of allowed or denied IP addresses was added as
described by the readme.
Closes#3
Instead of looking for a "secret" field hmac is used. Therefore the
raw payload is hashed with all secrets consecutively in order to
validate its content. If the content is certified the established
behaviour is pursued..
To create a minimalistic parser, nom is used to identify and replace
parameters given in the command field.
For clarity the `action` field for hooks was renamed to `command`.
All dependencies were updated.
An example configuration file `config.yml` is added to show the
configuration options. Following locations are checked:
- `/etc/webhookey/config.yml`
- `<config_dir>/webhookey/config.yml`
- `./config.yml`
Whereas `<config_dir>` is depending on the platform:
- Linux: `$XDG_CONFIG_HOME` or `$HOME/.config`
- macOS: `$HOME/Library/Application Support`
- Windows: `{FOLDERID_RoamingAppData}`
Each hook's action is executed if all of the specified filters match.