yhttpcmd is a tiny cmd2http(convert command as http service) server, used to execute local commands via http.
There are various ways of installing yhttpcmd.
go install github.com/yungkei/yhttpcmd@master
Docker images are available on Docker Hub.
You can launch a yhttpcmd container for trying it out with
docker run --name yhttpcmd -d -p 8080:8080 yungkei/yhttpcmd
yhttpcmd will now be reachable at http://localhost:8080/.
It is worth noting that, yhttpcmd only converts the commands set in the configuration into HTTP services.
yhttpcmd start --config=yhttpcmd.yaml
FROM yungkei/yhttpcmd
# overwrite default configuration file
COPY yhttpcmd.yaml /yhttpcmd/yhttpcmd.yaml
CMD [ "./yhttpcmd","start" ]
server:
port: 8080
command_configs:
- command: echo
route: echo
- command: <cmd>
route: <route>
curl -H "Content-Type:application/json" -d "{\"args\":\"hello\"}" -X POST 127.0.0.1:8080/echo
{"Command":"/bin/echo hello","Message":"hello\n"}
Apache License 2.0, see LICENSE.