Files
akvorado/cmd/healthcheck.go
Vincent Bernat b3a9f6ab2e chore: remove unused parameters
They were not detected by revive in function literals.
2024-02-08 08:30:33 +01:00

30 lines
584 B
Go

// SPDX-FileCopyrightText: 2022 Free Mobile
// SPDX-License-Identifier: AGPL-3.0-only
package cmd
import (
"net/http"
"github.com/spf13/cobra"
)
func init() {
RootCmd.AddCommand(healthcheckCmd)
}
var healthcheckCmd = &cobra.Command{
Use: "healthcheck",
Short: "Check healthness",
Long: `Check if Akvorado is alive using the builtin HTTP endpoint.`,
RunE: func(cmd *cobra.Command, _ []string) error {
resp, err := http.Get("http://localhost:8080/api/v0/healthcheck")
if err != nil {
return err
}
defer resp.Body.Close()
cmd.Println("ok")
return nil
},
}