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 22, 2021
1 parent 0b579c1 commit 6caafae
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 @@ -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
}
}

0 comments on commit 6caafae

Please sign in to comment.