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

This commit is contained in:
Derrick Hammer 2024-01-28 04:01:36 -05:00
parent 10ecaebbf2
commit ceabb95f6d
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 12 additions and 9 deletions

View File

@ -45,19 +45,22 @@ type S5ApiParams struct {
type S5ApiResult struct { type S5ApiResult struct {
fx.Out fx.Out
Protocol registry.API `group:"api"` API registry.API `group:"api"`
S5API *S5API
} }
func NewS5(params S5ApiParams) (S5ApiResult, error) { func NewS5(params S5ApiParams) (S5ApiResult, error) {
api := &S5API{
config: params.Config,
identity: params.Identity,
accounts: params.Accounts,
storage: params.Storage,
protocols: params.Protocols,
httpHandler: params.HttpHandler,
}
return S5ApiResult{ return S5ApiResult{
Protocol: &S5API{ API: api,
config: params.Config, S5API: api,
identity: params.Identity,
accounts: params.Accounts,
storage: params.Storage,
protocols: params.Protocols,
httpHandler: params.HttpHandler,
},
}, nil }, nil
} }