polish(node): define settings opts for 3rd party dep injection

- motivating use case running a lotus-sentinel node
This commit is contained in:
frrist 2021-03-03 13:15:13 -08:00
parent 0b579c1e03
commit 6caafaeee3

View File

@ -729,3 +729,19 @@ func Test() Option {
Override(new(*storageadapter.DealPublisher), storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{})),
)
}
// For 3rd party dep injection.
func WithRepoType(repoType repo.RepoType) func(s *Settings) error {
return func(s *Settings) error {
s.nodeType = repoType
return nil
}
}
func WithInvokesKey(i invoke, resApi interface{}) func(s *Settings) error {
return func(s *Settings) error {
s.invokes[i] = fx.Populate(resApi)
return nil
}
}