-
Notifications
You must be signed in to change notification settings - Fork 16
/
constants.go
120 lines (102 loc) · 3.12 KB
/
constants.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package config
import (
"log/syslog"
"time"
"github.com/rs/zerolog"
)
type (
Status uint
VerificationPolicy uint
CompatibilityPolicy uint
AcceptancePolicy uint
LogOutput uint
)
// Status is the status of the server.
const (
Running Status = iota
Stopped
)
// Policy is the policy for hook verification.
const (
// Non-strict (permissive) mode.
PassDown VerificationPolicy = iota // Pass down the extra keys/values in result to the next plugins
// Strict mode.
Ignore // Ignore errors and continue
Abort // Abort on first error and return results
Remove // Remove the hook from the list on error and continue
)
// CompatibilityPolicy is the compatibility policy for plugins.
const (
Strict CompatibilityPolicy = iota // Expect all required plugins to be loaded and present
Loose // Load the plugin, even if the requirements are not met
)
// AcceptancePolicy is the acceptance policy for custom hooks.
const (
Accept AcceptancePolicy = iota // Accept all custom hooks
Reject // Reject all custom hooks
)
// LogOutput is the output type for the logger.
const (
Console LogOutput = iota
Stdout
Stderr
File
Syslog
RSyslog
)
var (
DefaultLogOutput = [...]string{"console"}
DefaultSyslogPriority = syslog.LOG_LOCAL0 | syslog.LOG_DEBUG //nolint:nosnakecase
)
const (
// Config constants.
Default = "default"
EnvPrefix = "GATEWAYD_"
// Logger constants.
DefaultLogFileName = "gatewayd.log"
DefaultLogLevel = "info"
DefaultTimeFormat = zerolog.TimeFormatUnix
DefaultConsoleTimeFormat = time.RFC3339
DefaultMaxSize = 500 // megabytes
DefaultMaxBackups = 5
DefaultMaxAge = 30 // days
DefaultCompress = true
DefaultLocalTime = false
DefaultSyslogTag = "gatewayd"
DefaultRSyslogNetwork = "tcp"
DefaultRSyslogAddress = "localhost:514"
// Plugin constants.
DefaultMinPort = 50000
DefaultMaxPort = 60000
PluginPriorityStart = 1000
LoggerName = "plugin"
DefaultPluginAddress = "http://plugins/metrics"
DefaultMetricsMergerPeriod = 5 * time.Second
// Client constants.
DefaultChunkSize = 4096
DefaultReceiveDeadline = 0 // 0 means no deadline (timeout)
DefaultSendDeadline = 0
DefaultTCPKeepAlivePeriod = 30 * time.Second
// Pool constants.
EmptyPoolCapacity = 0
DefaultPoolSize = 10
MinimumPoolSize = 2
DefaultHealthCheckPeriod = 60 * time.Second // This must match PostgreSQL authentication timeout.
// Server constants.
DefaultListenNetwork = "tcp"
DefaultListenAddress = "0.0.0.0:15432"
DefaultTickInterval = 5 * time.Second
DefaultBufferSize = 1 << 24 // 16777216 bytes
DefaultTCPKeepAlive = 3 * time.Second
DefaultLoadBalancer = "roundrobin"
// Utility constants.
DefaultSeed = 1000
ChecksumBufferSize = 65536
// Metrics constants.
DefaultMetricsAddress = "localhost:2112"
DefaultMetricsPath = "/metrics"
// Sentry constants.
DefaultTraceSampleRate = 0.2
DefaultAttachStacktrace = true
DefaultFlushTimeout = 2 * time.Second
)