traefik-certs-dumper/cmd/zookeeper.go
2022-08-29 08:57:30 +02:00

36 lines
776 B
Go

package cmd
import (
"context"
"github.com/kvtools/valkeyrie/store"
"github.com/kvtools/valkeyrie/store/zookeeper"
"github.com/ldez/traefik-certs-dumper/v2/dumper"
"github.com/ldez/traefik-certs-dumper/v2/dumper/kv"
"github.com/spf13/cobra"
)
// zookeeperCmd represents the zookeeper command.
var zookeeperCmd = &cobra.Command{
Use: "zookeeper",
Short: "Dump the content of zookeeper.",
Long: `Dump the content of zookeeper.`,
RunE: runE(zookeeperRun),
}
func init() {
kvCmd.AddCommand(zookeeperCmd)
}
func zookeeperRun(baseConfig *dumper.BaseConfig, cmd *cobra.Command) error {
config, err := getKvConfig(cmd)
if err != nil {
return err
}
config.Backend = store.ZK
zookeeper.Register()
return kv.Dump(context.Background(), config, baseConfig)
}