Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var App = fx.Options( fx.Module( module, fx.Decorate( func(l logger.Logger) logger.Logger { return l.WithScope(module) }, ), fx.Provide( func(c config.Config) (keyfunc.Keyfunc, error) { return keyfunc.NewDefault([]string{c.JWKS_URL}) }, jwt.NewManager, ), fx.Provide( interceptor.NewAuth, fx.Annotate(service.NewVsApiV1, fx.As(new(v1.VintageServiceServer))), New, ), fx.Invoke( func(lc fx.Lifecycle, log logger.Logger, c config.Config, server *Server) { lc.Append( fx.Hook{ OnStart: func(ctx context.Context) error { go func() { addr := fmt.Sprintf(":%d", c.GrpcPort) err := server.Run(context.Background(), "tcp", addr) if err != nil { log.Error("server stopped", zap.Error(err)) } }() go func() { grpcaddr := fmt.Sprintf(":%d", c.GrpcPort) addr := fmt.Sprintf(":%d", c.GateAwayPort) err := server.RunInProcessGateway( context.Background(), grpcaddr, addr, runtime.WithMarshalerOption( runtime.MIMEWildcard, &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ UseProtoNames: true, EmitDefaultValues: true, }, UnmarshalOptions: protojson.UnmarshalOptions{}, }, ), ) if err != nil { log.Error("gw server stopped", zap.Error(err)) } }() log.Info("server started", zap.String("port", strconv.Itoa(c.GrpcPort))) return nil }, OnStop: func(ctx context.Context) error { log.Info("gracefully stopping grpc server...") server.GracefulStop(context.Background()) log.Info("server stopped") return nil }, }, ) }, ), ), )
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct {
fx.In
AuthInterceptor *interceptor.Auth
Config config.Config
Log logger.Logger
VsApiV1 v1.VintageServiceServer
LeaderboardV1 leaderboardv1.LeaderboardServiceServer
RulesV1 rulesv1.RuleServiceServer
VerificationV1 verificationv1.VerificationServiceServer
UserV1 userv1.UserServiceServer
SettlementV1 settlementv1.SettlementServiceServer
NotificationV1 notificationv1.NotificationServiceServer
}
type Server ¶ added in v1.5.0
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GracefulStop ¶ added in v1.5.0
func (*Server) RunInProcessGateway ¶ added in v1.5.0
func (s *Server) RunInProcessGateway(ctx context.Context, grpcaddr, addr string, opts ...runtime.ServeMuxOption) error
RunInProcessGateway starts the invoke in process http gateway.
Click to show internal directories.
Click to hide internal directories.