Add streaming command support.

Add options
- `stream-stdout-in-response`
- `stream-stdout-in-response-on-error`
- `stream-command-kill-grace-period-seconds`

to allow defining webhooks which dynamically stream large content back to the
requestor. This allows the creation of download endpoints from scripts, i.e.
running a `git archive` command or a database dump from a docker container,
without needing to buffer up the original.
This commit is contained in:
Will Rouesnel 2019-03-01 15:17:23 +11:00
parent 0aa7395e21
commit 08fc28b38f
8 changed files with 564 additions and 128 deletions

View file

@ -420,6 +420,9 @@ type Hook struct {
ResponseHeaders ResponseHeaders `json:"response-headers,omitempty"`
CaptureCommandOutput bool `json:"include-command-output-in-response,omitempty"`
CaptureCommandOutputOnError bool `json:"include-command-output-in-response-on-error,omitempty"`
StreamCommandStdout bool `json:"stream-stdout-in-response,omitempty"`
StreamCommandStderrOnError bool `json:"stream-stderr-in-response-on-error,omitempty"`
StreamCommandKillGraceSecs float64 `json:"stream-command-kill-grace-period-seconds,omitempty"`
PassEnvironmentToCommand []Argument `json:"pass-environment-to-command,omitempty"`
PassArgumentsToCommand []Argument `json:"pass-arguments-to-command,omitempty"`
PassFileToCommand []Argument `json:"pass-file-to-command,omitempty"`