Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Module fx.Option = fx.Module( "framework", fx.Provide(func(ev *env.Env) *fm { return &fm{Env: ev} }), repos.NewMongoClientFx[*fm](), fx.Provide(func(logger *slog.Logger, ev *env.Env) (app.IAMGrpcServer, error) { return grpc.NewGrpcServer(grpc.ServerOpts{Logger: logger, ShowLogs: ev.ShowGRPCLogs}) }), app.Module, fx.Invoke(func(lf fx.Lifecycle, server app.IAMGrpcServer, ev *env.Env) { lf.Append(fx.Hook{ OnStart: func(ctx context.Context) error { timeout, cf := context.WithTimeout(ctx, 2*time.Second) defer cf() errCh := make(chan error, 1) go func() { if err := server.Listen(fmt.Sprintf(":%d", ev.GrpcPort)); err != nil { errCh <- err } }() select { case <-timeout.Done(): case err := <-errCh: return errors.NewE(err) } return nil }, OnStop: func(ctx context.Context) error { server.Stop() return nil }, }) }), )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.