etcd.go 305 B

12345678910111213141516171819202122
  1. package clinit
  2. import (
  3. "go.etcd.io/etcd/client/v3"
  4. )
  5. var cli *clientv3.Client
  6. func GetEtcdClient() *clientv3.Client {
  7. return cli
  8. }
  9. func EctdHandler(etcdAddrs []string) {
  10. var err error
  11. cli , err = clientv3.New(clientv3.Config{
  12. Endpoints: etcdAddrs,
  13. })
  14. if err != nil {
  15. panic(err)
  16. }
  17. return
  18. }