From 18a54917a00582331422f6fe5f787d329e1b10fd Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 28 Jan 2024 04:45:34 -0500 Subject: [PATCH] fix: add LifecyclesParams struct --- api/api.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/api.go b/api/api.go index de677fb..5649efa 100644 --- a/api/api.go +++ b/api/api.go @@ -31,9 +31,15 @@ func BuildApis(config *viper.Viper) fx.Option { return fx.Options(options...) } -func SetupLifecycles(lifecycle fx.Lifecycle, protocols []registry.API) { +type LifecyclesParams struct { + fx.In + + Protocols []registry.API `group:"protocol"` +} + +func SetupLifecycles(lifecycle fx.Lifecycle, params LifecyclesParams) { for _, entry := range registry.GetRegistry() { - for _, protocol := range protocols { + for _, protocol := range params.Protocols { if protocol.Name() == entry.Key { lifecycle.Append(fx.Hook{ OnStart: func(ctx context.Context) error {