forked from rai-project/grpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
51 lines (41 loc) · 818 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
39
40
41
42
43
44
45
46
47
48
49
50
51
package grpc
import (
"github.com/k0kubun/pp/v3"
"github.com/c3sr/config"
"github.com/c3sr/vipertags"
)
type grpcConfig struct {
EnableCUPTI *bool `json:"cupti" config:"grpc.cupti"`
done chan struct{} `json:"-" config:"-"`
}
var (
Config = &grpcConfig{
done: make(chan struct{}),
}
)
func (grpcConfig) ConfigName() string {
return "grpc"
}
func (a *grpcConfig) SetDefaults() {
vipertags.SetDefaults(a)
}
func (a *grpcConfig) Read() {
defer close(a.done)
vipertags.Fill(a)
if a.EnableCUPTI == nil {
a.EnableCUPTI = new(bool)
*a.EnableCUPTI = DefaultCUPTIEnabled
}
}
func (c grpcConfig) Wait() {
<-c.done
}
func (c grpcConfig) String() string {
return pp.Sprintln(c)
}
func (c grpcConfig) Debug() {
log.Debug("grpc Config = ", c)
}
func init() {
config.Register(Config)
}