/
base-config.go
69 lines (61 loc) · 1.54 KB
/
base-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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package protod
// Configuration base struct
type EnvoyConfig struct {
Node *Node `yaml:"node"`
DynamicResources *DynamicResources `yaml:"dynamic_resources"`
Admin *Admin `yaml:"admin"`
}
// Node is used for instance identification purposes
type Node struct {
Cluster string `yaml:"cluster"`
ID string `yaml:"id"`
}
// DynamicResources specify where to load dynamic configuration from.
type DynamicResources struct {
CDSConfig *ConfigSource `yaml:"cds_config"`
LDSConfig *ConfigSource `yaml:"lds_config"`
}
// ConfigSource for each xDS API source
type ConfigSource struct {
Path string `yaml:"path"`
}
// Admin interface config
type Admin struct {
AccessLogPath string `yaml:"access_log_path"`
Adress *Adress `yaml:"address"`
}
// Adress is the TCP address that the administration server will listen on.
type Adress struct {
SocketAdress *SocketAdress `yaml:"socket_address"`
}
// SocketAdress config about the socket
type SocketAdress struct {
Adress string `yaml:"address"`
PortValue int `yaml:"port_value"`
}
// GenerateEnvoyConfig from CLI flags
func GenerateEnvoyConfig() *EnvoyConfig {
return &EnvoyConfig{
&Node{
Cluster: "example",
ID: "node-1",
},
&DynamicResources{
CDSConfig: &ConfigSource{
Path: "/tmp/cds.yaml",
},
LDSConfig: &ConfigSource{
Path: "/tmp/lds.yaml",
},
},
&Admin{
AccessLogPath: "/dev/null",
Adress: &Adress{
SocketAdress: &SocketAdress{
Adress: "0.0.0.0",
PortValue: 19000,
},
},
},
}
}