fix: need to use a param struct

This commit is contained in:
Derrick Hammer 2024-02-17 05:23:33 -05:00
parent ac9a1a0b92
commit d4be04eae9
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 9 additions and 4 deletions

View File

@ -33,8 +33,13 @@ func BuildApis(config *viper.Viper) fx.Option {
} }
} }
options = append(options, fx.Invoke(func(protocols []registry.API) error { type initParams struct {
for _, protocol := range protocols { fx.In
Protocols []registry.API `group:"api"`
}
options = append(options, fx.Invoke(func(params initParams) error {
for _, protocol := range params.Protocols {
err := protocol.Init() err := protocol.Init()
if err != nil { if err != nil {
return err return err
@ -44,8 +49,8 @@ func BuildApis(config *viper.Viper) fx.Option {
return nil return nil
})) }))
options = append(options, fx.Invoke(func(protocols []registry.API) error { options = append(options, fx.Invoke(func(params initParams) error {
for _, protocol := range protocols { for _, protocol := range params.Protocols {
routes, err := protocol.Routes() routes, err := protocol.Routes()
if err != nil { if err != nil {
return err return err