From 6caafaeee36f4141509786d9c99fbd6990ef87ee Mon Sep 17 00:00:00 2001 From: frrist Date: Wed, 3 Mar 2021 13:15:13 -0800 Subject: [PATCH] polish(node): define settings opts for 3rd party dep injection - motivating use case running a lotus-sentinel node --- node/builder.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/node/builder.go b/node/builder.go index 33a947826..ece74896c 100644 --- a/node/builder.go +++ b/node/builder.go @@ -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 + } +}