fix: we need to pass out the protocol in both struct and interface form for fx to read it properly

This commit is contained in:
Derrick Hammer 2024-01-28 03:58:49 -05:00
parent 98c1784518
commit 10ecaebbf2
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 12 additions and 8 deletions

View File

@ -45,7 +45,8 @@ type S5ProtocolParams struct {
type S5ProtocolResult struct { type S5ProtocolResult struct {
fx.Out fx.Out
Protocol registry.Protocol `group:"protocol"` Protocol registry.Protocol `group:"protocol"`
S5Protocol *S5Protocol
} }
var S5ProtocolModule = fx.Module("s5_protocol", var S5ProtocolModule = fx.Module("s5_protocol",
@ -56,14 +57,17 @@ var S5ProtocolModule = fx.Module("s5_protocol",
func NewS5Protocol( func NewS5Protocol(
params S5ProtocolParams, params S5ProtocolParams,
) (S5ProtocolResult, error) { ) (S5ProtocolResult, error) {
proto := &S5Protocol{
config: params.Config,
logger: params.Logger,
storage: params.Storage,
identity: params.Identity,
providerStore: params.ProviderStore,
}
return S5ProtocolResult{ return S5ProtocolResult{
Protocol: &S5Protocol{ Protocol: proto,
config: params.Config, S5Protocol: proto,
logger: params.Logger,
storage: params.Storage,
identity: params.Identity,
providerStore: params.ProviderStore,
},
}, nil }, nil
} }