forked from gree/futurama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
55 lines (49 loc) · 1.5 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
package futurama
type Config struct {
StatIntervalSec int `json:"stat_interval_sec"`
SchedulerConfig
MySQLConfig
}
type SchedulerConfig struct {
MaxScheduledEvents int `json:"max_scheduled_events"`
MaxRetry int `json:"max_retry"`
}
type MySQLConfig struct {
MySQL6 bool `json:"mysql6"`
User string `json:"username"`
Pass string `json:"password"`
Host string `json:"host"`
Port int `json:"port"`
DbName string `json:"db_name"`
TableName string `json:"table_name"`
MaxOpenConnection int `json:"max_open_connection"`
ConsumerName string `json:"queue_name"`
ConsumerLockTimeoutSec int `json:"consumer_lock_timeout_sec"`
ConsumerTimeWindowSec int `json:"consumer_time_window_sec"`
ConsumerSelectLimit int `json:"consumer_select_limit"`
ConsumerSleepMSec int `json:"consumer_sleep_msec"`
}
func DefaultConfig() *Config {
return &Config{
StatIntervalSec: 0,
SchedulerConfig: SchedulerConfig{
MaxScheduledEvents: 10000,
MaxRetry: 18,
},
MySQLConfig: MySQLConfig{
MySQL6: true,
User: "root",
Pass: "",
Host: "127.0.0.1",
Port: 3306,
DbName: "futurama",
TableName: "events",
MaxOpenConnection: 10,
ConsumerName: "",
ConsumerLockTimeoutSec: 31,
ConsumerTimeWindowSec: 5,
ConsumerSelectLimit: 50,
ConsumerSleepMSec: 100,
},
}
}