mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-01 20:43:43 +01:00
c3bc85e22d
rename the go module to netbirdio/netbird as part of our rebranding.
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"github.com/netbirdio/netbird/util"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
"google.golang.org/grpc/status"
|
|
|
|
"github.com/netbirdio/netbird/client/internal"
|
|
"github.com/netbirdio/netbird/client/proto"
|
|
)
|
|
|
|
var statusCmd = &cobra.Command{
|
|
Use: "status",
|
|
Short: "status of the Wiretrustee Service",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
SetFlagsFromEnvVars()
|
|
|
|
err := util.InitLog(logLevel, "console")
|
|
if err != nil {
|
|
log.Errorf("failed initializing log %v", err)
|
|
return err
|
|
}
|
|
|
|
ctx := internal.CtxInitState(context.Background())
|
|
|
|
conn, err := DialClientGRPCServer(ctx, daemonAddr)
|
|
if err != nil {
|
|
log.Errorf("failed to connect to service CLI interface %v", err)
|
|
return err
|
|
}
|
|
defer conn.Close()
|
|
|
|
resp, err := proto.NewDaemonServiceClient(conn).Status(cmd.Context(), &proto.StatusRequest{})
|
|
if err != nil {
|
|
log.Errorf("status failed: %v", status.Convert(err).Message())
|
|
return nil
|
|
}
|
|
|
|
log.Infof("status: %v", resp.Status)
|
|
return nil
|
|
},
|
|
}
|