go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

how to set etcd username and password in gateway

Open yunduansing opened this issue 1 year ago • 1 comments

I use the gateway feature of go-zero to implement the mapping from HTTP to gRPC, and use etcd as the RPC service discovery. However, when I set the username and password for etcd, the etcd client reports: "etcdserver: permission denied".

go code: gc.Upstreams[i].Grpc.Etcd.Hosts = config.Conf.EtcdAddress gc.Upstreams[i].Grpc.Etcd.User = config.Conf.EtcdUser gc.Upstreams[i].Grpc.Etcd.Pass = config.Conf.EtcdSecret

xxx.yaml

Upstreams:

  • Grpc: Etcd: Key: user Hosts: - ""

    proto set mode

    ProtoSets: - ./protocol/user/user_req.pb - ./protocol/user/user_res.pb - ./protocol/user/user_service.pb

    Mappings can also be written in proto options

    Mappings: - Method: get Path: /user RpcPath: user.UserService/GetUser

yunduansing avatar Dec 28 '23 02:12 yunduansing

Verify you're setting correct username/password.

kevwan avatar Jan 13 '24 15:01 kevwan