/
config.go
68 lines (59 loc) · 2.03 KB
/
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
package config
// BasicAuth configuration
type BasicAuth struct {
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
SecretRef string `mapstructure:"secretRef"`
}
// API configuration
type API struct {
Port int `mapstructure:"port"`
Logging bool `mapstructure:"logging"`
BasicAuth BasicAuth `mapstructure:"basicAuth"`
}
type Logging struct {
LogLevel int8 `mapstructure:"logLevel"`
Encoding string `mapstructure:"encoding"`
Development bool `mapstructure:"development"`
}
// REST configuration
type REST struct {
Enabled bool `mapstructure:"enabled"`
}
// Metrics configuration
type Metrics struct {
Enabled bool `mapstructure:"enabled"`
}
// Results configuration
type Results struct {
MaxPerReport int `mapstructure:"maxPerReport"`
KeepOnlyLatest bool `mapstructure:"keepOnlyLatest"`
}
// LeaderElection configuration
type LeaderElection struct {
LockName string `mapstructure:"lockName"`
PodName string `mapstructure:"podName"`
LeaseDuration int `mapstructure:"leaseDuration"`
RenewDeadline int `mapstructure:"renewDeadline"`
RetryPeriod int `mapstructure:"retryPeriod"`
ReleaseOnCancel bool `mapstructure:"releaseOnCancel"`
Enabled bool `mapstructure:"enabled"`
}
// BlockReports configuration
type BlockReports struct {
Enabled bool `mapstructure:"enabled"`
Results Results `mapstructure:"results"`
Source string `mapstructure:"source"`
EventNamespace string `mapstructure:"eventNamespace"`
}
// Config of the Policyer
type Config struct {
API API `mapstructure:"api"`
REST REST `mapstructure:"rest"`
Metrics Metrics `mapstructure:"metrics"`
Kubeconfig string `mapstructure:"kubeconfig"`
BlockReports BlockReports `mapstructure:"blockReports"`
LeaderElection LeaderElection `mapstructure:"leaderElection"`
Logging Logging `mapstructure:"logging"`
Namespace string `mapstructure:"namespace"`
}