Files
sablier/cmd/health.go
2022-11-14 18:46:38 +00:00

26 lines
519 B
Go

package cmd
import (
"fmt"
"os"
"github.com/acouvreur/sablier/app/http/healthcheck"
"github.com/spf13/cobra"
)
var healthCmd = &cobra.Command{
Use: "health",
Short: "Calls the health endpoint of a Sablier instance",
Run: func(cmd *cobra.Command, args []string) {
details, healthy := healthcheck.Health(cmd.Flag("url").Value.String())
if healthy {
fmt.Fprintf(os.Stderr, "healthy: %v\n", details)
os.Exit(0)
} else {
fmt.Fprintf(os.Stderr, "unhealthy: %v\n", details)
os.Exit(1)
}
},
}