Commit graph

59 commits

Author SHA1 Message Date
finga a130bdc125 Print stdout and stderr as string
As the `stdout` as well as the `stderr` were printed as `Vec<u8>` we
now convert it to a string.
2021-03-22 11:12:45 +01:00
finga a6ab0b4ef6 Remove unneeded lifetime annotations 2021-03-21 23:40:23 +01:00
finga 0610fd49c9 Replace command parameters with values
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`.
2021-03-21 22:38:14 +01:00
finga 12c3b12c31 Improve secret handling and add tests
Instead of a string `receive_hook` returns a `Response` now. Some
rudimentary tests were added.
2021-03-20 00:14:08 +01:00
finga b370d59b40 Implement secret functionality
In order to validate requests a field called `secret` has to be sent
containing a secret key which validates the request. A hook will be
executed only if the secret sent with the request matches the hook's
secret.
2021-03-19 10:40:19 +01:00
finga ea19c7e413 Enable arguments in action fields of hooks 2021-03-17 13:42:48 +01:00
finga 82ccbf0a7e Implement proper logging
The `log` and `env_logger` crates are used for logging.
2021-03-03 17:01:41 +01:00
finga c8505b27c5 Parse config file and act upon
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.
2021-03-03 15:36:31 +01:00
finga d8ca63ab37 Parse JSON from post request
Accept a post request and try to parse it expecting the data is
formated in JSON.
2021-02-02 11:17:27 +01:00