refactor: need to use a param struct to get protocol value group
This commit is contained in:
parent
afc0b7a343
commit
857ffe4fdd
|
@ -26,8 +26,12 @@ func BuildProtocols(config *viper.Viper) fx.Option {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options = append(options, fx.Invoke(func(protocols []registry.Protocol) error {
|
type initParams struct {
|
||||||
for _, protocol := range protocols {
|
Protocols []registry.Protocol `group:"protocol"`
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue