37 lines
689 B
Go
37 lines
689 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
|
||
|
gohealthchecks "git.faercol.me/faercol/go-healthchecks"
|
||
|
)
|
||
|
|
||
|
func mustParseUUIDCheck(rawVal string) gohealthchecks.Check {
|
||
|
check, err := gohealthchecks.NewUUIDCheck(rawVal)
|
||
|
if err != nil {
|
||
|
failf("Invalid UUID: %s\n", err)
|
||
|
}
|
||
|
return check
|
||
|
}
|
||
|
|
||
|
func parseCheckFlags() gohealthchecks.Check {
|
||
|
var check gohealthchecks.Check
|
||
|
if checkUUID != "" {
|
||
|
check = mustParseUUIDCheck(checkUUID)
|
||
|
} else {
|
||
|
check = gohealthchecks.NewSlugCheck(pingKey, checkSlug, autoCreate)
|
||
|
}
|
||
|
return check
|
||
|
}
|
||
|
|
||
|
func failf(format string, args ...any) {
|
||
|
fmt.Fprintf(os.Stderr, format, args...)
|
||
|
os.Exit(1)
|
||
|
}
|
||
|
|
||
|
func failln(msg string) {
|
||
|
fmt.Fprintln(os.Stderr, msg)
|
||
|
os.Exit(1)
|
||
|
}
|