forked from RackHD/inservice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugins.go
More file actions
38 lines (29 loc) · 737 Bytes
/
plugins.go
File metadata and controls
38 lines (29 loc) · 737 Bytes
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
package main
import (
"log"
"github.com/RackHD/inservice/agent"
)
// PluginServer provides PluginHost configuration and management.
type PluginServer struct {
plugins []string
address string
port int
host *plugins.PluginHost
}
// NewPluginServer returns a new PluginServer instance.
func NewPluginServer(address string, port int, plugins []string) (*PluginServer, error) {
return &PluginServer{
address: address,
port: port,
plugins: plugins,
}, nil
}
// Serve runs the PluginServer in blocking mode.
func (s *PluginServer) Serve() {
var err error
s.host, err = plugins.NewPluginHost(s.address, s.port, s.plugins)
if err != nil {
log.Fatalf("Error creating Plugin Host: %s\n", err)
}
s.host.Serve()
}