runitor icon indicating copy to clipboard operation
runitor copied to clipboard

Feature request: `-create` flag

Open cuu508 opened this issue 2 years ago • 2 comments

When pinging by slug, Healthchecks can optionally auto-create a new check if a check with the specified slug does not exist. To enable this feature, the ping URL needs a ?create=1 query parameter added at the end:

$ curl https://hc-ping.com/fixme-ping-key/does-not-exist
# returns HTTP 404 because a check with slug "does-not-exist" does indeed not exist


$ curl https://hc-ping.com/fixme-ping-key/does-not-exist?create=1
# creates a new check and returns HTTP 201


$ curl https://hc-ping.com/fixme-ping-key/does-not-exist?create=1
# the check now exists, so the server returns HTTP 200

It would be great if there was a way to tell runitor to add the create=1 parameter in ping URLs. Perhaps something like:

runitor -ping-key fixme-ping-key -slug does-not-exist -create -- somecommand

@bdd what do you think? If something like the above looks OK, I can try my hand at implementing it.

cuu508 avatar Jul 06 '23 07:07 cuu508

@cuu508 can you please try the release at https://github.com/bdd/runitor/releases/tag/v1.3.0-beta.2?

See the commit above for code review.

bdd avatar Jul 09 '23 00:07 bdd

Awesome!

I tested v1.3.0-beta.2 and it worked exactly as I was expecting.

The help text for the -create flag is:

Create a new check if slug is not found in the project

Perhaps it could mention what happens if you use -create with -uuid:

Create a new check if slug is not found in the project. Has no effect if pinging by UUID

cuu508 avatar Jul 10 '23 07:07 cuu508