This is an example repository showcasing the usage of gRPC with Go, including server and client implementations.
The following environment variables can be used to configure the application:
Name | Description | Default | Required |
---|---|---|---|
GRPC_ENDPOINT | grpc server endpoint | localhost:50051 | false |
KEY_ID | hmac key id | 1 | false |
SECRET_KEY | hmac secret key | 123456 | false |
export GRPC_ENDPOINT=localhost:50051
export KEY_ID=my-key-id
export SECRET_KEY=my-secret-key
You can generate the protobuf code using one of the following methods:
go generate ./...
protoc \
-I=./api/proto \
--go_out=. \
--go_opt=module=github.com/msharbaji/grpc-go-example \
--go-grpc_out=. \
--go-grpc_opt=module=github.com/msharbaji/grpc-go-example \
./api/proto/v1/*.proto
buf generate
To run the server, execute the following command:
make run-server