natshook

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

natshook

Subscribe for NATS server and run scripts whenever the specific subject is triggered.

Usage

Usage:
  natshook [OPTIONS]

Application Options:
  -a, --addr=      Address to listen on (default: :4222)
  -f, --file=      Path to the toml file containing hooks definition
      --pid=       Create PID file at the given path
      --creds=     User Credentials File
      --nkey=      NKey Seed File
      --tlscert=   TLS client certificate file
      --tlskey=    Private key file for client certificate
      --tlscacert= CA certificate to verify peer against

Help Options:
  -h, --help       Show this help message

Define some hooks you want to serve in hooks.toml.

[[hooks]]
subject = 'sample'
command = '/path/to/script.sh'

Run natshook as below:

$ natshook --file hooks.toml
2022/08/01 21:00:00 Subscribe subject 'sample'

Then you can execute the script by publish a message to NATS server:

$ cat input.json | nats request sample

Requested payload will be passed to the script as stdin. The output result will be displayed.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL