Skip to content

Commit

Permalink
polish(node): define settings opts for 3rd party dep injection
Browse files Browse the repository at this point in the history
- motivating use case running a lotus-sentinel node
  • Loading branch information
frrist committed Mar 3, 2021
1 parent 3d68abc commit 7145cca
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions node/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,3 +697,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
}
}

0 comments on commit 7145cca

Please sign in to comment.