Execute terminal commands using HTTP requests
go-to-exec
is an open-source program that lets you execute terminal commands using HTTP requests.
Here is a configuration example:
Now, if we were to make a curl
request, like curl "http://localhost:7055/hello/paul"
, we would receive:
{"output":"Hello PAUL\n"}
go-to-exec
can be configured to execute any program, and it accepts templates (using the famous Sprig library) to customize its arguments.
For every HTTP requests, both the URL parameters and body are parsed, and are available to use in the templates. A full listener configuration example would be:
We can trigger it with:
Or, if we are using JSON:
To get started, you can download a pre-build binary from the releases page, or use the pre-built Docker image.
Also, as a side benefit, go-to-exec
can easily be used as a destination for a Notify17 action!
P.S. another use case, is if you want to restart Kubernetes deployments using HTTP requests.