-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
main.go
42 lines (33 loc) · 891 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"github.com/hashicorp/go-plugin"
"github.com/smartcontractkit/chainlink-relay/pkg/loop"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/median"
"github.com/smartcontractkit/chainlink/v2/plugins"
)
const (
loggerName = "PluginMedian"
)
func main() {
s := plugins.MustNewStartedServer(loggerName)
defer s.Stop()
p := median.NewPlugin(s.Logger)
defer s.Logger.ErrorIfFn(p.Close, "Failed to close")
s.MustRegister(p)
stop := make(chan struct{})
defer close(stop)
plugin.Serve(&plugin.ServeConfig{
HandshakeConfig: loop.PluginMedianHandshakeConfig(),
Plugins: map[string]plugin.Plugin{
loop.PluginMedianName: &loop.GRPCPluginMedian{
PluginServer: p,
BrokerConfig: loop.BrokerConfig{
StopCh: stop,
Logger: s.Logger,
GRPCOpts: s.GRPCOpts,
},
},
},
GRPCServer: s.GRPCOpts.NewServer,
})
}