go-zero
go-zero copied to clipboard
how to set etcd username and password in gateway
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.pbMappings can also be written in proto options
Mappings: - Method: get Path: /user RpcPath: user.UserService/GetUser
Verify you're setting correct username/password.