-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
38 lines (33 loc) · 1001 Bytes
/
config.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
package pluto
import (
context "golang.org/x/net/context"
"github.com/aukbit/pluto/v6/client"
"github.com/aukbit/pluto/v6/common"
"github.com/aukbit/pluto/v6/discovery"
"github.com/aukbit/pluto/v6/server"
)
// Config pluto service config
type Config struct {
ID string
Name string
Description string
clientsCh chan *client.Client
Discovery discovery.Discovery
HealthAddr string // TCP address (e.g. localhost:8000) to listen on, ":http" if empty
Servers map[string]*server.Server
Clients map[string]*client.Client
Hooks map[string][]HookFunc
}
// HookFunc hook function type
type HookFunc func(context.Context) error
func newConfig() Config {
return Config{
ID: common.RandID("plt_", 6),
Name: defaultName,
Servers: make(map[string]*server.Server),
Clients: make(map[string]*client.Client),
clientsCh: make(chan *client.Client, 100),
Hooks: make(map[string][]HookFunc),
HealthAddr: defaultHealthAddr,
}
}