Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GrpcConfig ¶
type GrpcConfig struct { Port string `mapstructure:"grpc-port"` GracePeriod time.Duration `mapstructure:"grpc-grace-period"` }
HttpConfig defines all configuration fields for the gRPC server
type GrpcServer ¶
GrpcServer defines the default behaviour of gRPC servers
func NewGrpcServer ¶
func NewGrpcServer(logger *zap.Logger, config *GrpcConfig) *GrpcServer
NewGrpcServer returns a new, pre-initialized, GrpcServer instance The application will terminate if the server cannot bind to the configured port. If the application does not terminate, the port is open and a raw gRPC server has been created after the call of NewGrpcServer() 'tracer' may be nil, in this case the feature is disabled
func (*GrpcServer) Health ¶
func (srv *GrpcServer) Health() http.HandlerFunc
Health returns a http.HandlerFunc, it reports the gRPC server health: OK or UNHEALTHY
func (*GrpcServer) ListenAndServe ¶
func (srv *GrpcServer) ListenAndServe(ctx context.Context, wg *sync.WaitGroup)
ListenAndServe ties everything together and runs the gRPC server in a separate goroutine. The method then blocks until the passed context is cancelled, so this method should also be started as goroutine if more work is needed after starting the gRPC server.
type HttpConfig ¶
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func NewHttpServer ¶
func NewHttpServer(logger *zap.Logger, config *HttpConfig) *HttpServer
func (*HttpServer) Health ¶
func (srv *HttpServer) Health() http.HandlerFunc
Health returns a http.HandlerFunc, it reports the gRPC server health: OK or UNHEALTHY