mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-21 16:17:13 +00:00
config types split go files
This commit is contained in:
parent
4c0dced370
commit
e42dbe520a
8
config/types/categoryLimitConfig.go
Normal file
8
config/types/categoryLimitConfig.go
Normal file
@ -0,0 +1,8 @@
|
||||
package config
|
||||
|
||||
type CategoryLimitConfig struct {
|
||||
Regular LimitBurst `yaml:"regular"`
|
||||
Replaceable LimitBurst `yaml:"replaceable"`
|
||||
ParameterizedReplaceable LimitBurst `yaml:"parameterized_replaceable"`
|
||||
Ephemeral LimitBurst `yaml:"ephemeral"`
|
||||
}
|
7
config/types/kindLimitConfig.go
Normal file
7
config/types/kindLimitConfig.go
Normal file
@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
type KindLimitConfig struct {
|
||||
Kind int `yaml:"kind"`
|
||||
Limit float64 `yaml:"limit"`
|
||||
Burst int `yaml:"burst"`
|
||||
}
|
6
config/types/kindSizeLimitConfig.go
Normal file
6
config/types/kindSizeLimitConfig.go
Normal file
@ -0,0 +1,6 @@
|
||||
package config
|
||||
|
||||
type KindSizeLimitConfig struct {
|
||||
Kind int `yaml:"kind"`
|
||||
MaxSize int `yaml:"max_size"`
|
||||
}
|
6
config/types/limitBurst.go
Normal file
6
config/types/limitBurst.go
Normal file
@ -0,0 +1,6 @@
|
||||
package config
|
||||
|
||||
type LimitBurst struct {
|
||||
Limit float64 `yaml:"limit"`
|
||||
Burst int `yaml:"burst"`
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package config
|
||||
|
||||
type ServerConfig struct {
|
||||
MongoDB struct {
|
||||
URI string `yaml:"uri"`
|
||||
Database string `yaml:"database"`
|
||||
} `yaml:"mongodb"`
|
||||
Server struct {
|
||||
Port string `yaml:"port"`
|
||||
} `yaml:"server"`
|
||||
RateLimit RateLimitConfig `yaml:"rate_limit"`
|
||||
}
|
||||
|
||||
type LimitBurst struct {
|
||||
Limit float64 `yaml:"limit"`
|
||||
Burst int `yaml:"burst"`
|
||||
}
|
||||
|
||||
type KindSizeLimitConfig struct {
|
||||
Kind int `yaml:"kind"`
|
||||
MaxSize int `yaml:"max_size"`
|
||||
}
|
||||
|
||||
type RateLimitConfig struct {
|
||||
WsLimit float64 `yaml:"ws_limit"`
|
||||
WsBurst int `yaml:"ws_burst"`
|
||||
EventLimit float64 `yaml:"event_limit"`
|
||||
EventBurst int `yaml:"event_burst"`
|
||||
ReqLimit float64 `yaml:"req_limit"`
|
||||
ReqBurst int `yaml:"req_burst"`
|
||||
MaxEventSize int `yaml:"max_event_size"`
|
||||
KindSizeLimits []KindSizeLimitConfig `yaml:"kind_size_limits"`
|
||||
CategoryLimits map[string]KindLimitConfig `yaml:"category_limits"`
|
||||
KindLimits []KindLimitConfig `yaml:"kind_limits"`
|
||||
}
|
||||
|
||||
type CategoryLimitConfig struct {
|
||||
Regular LimitBurst `yaml:"regular"`
|
||||
Replaceable LimitBurst `yaml:"replaceable"`
|
||||
ParameterizedReplaceable LimitBurst `yaml:"parameterized_replaceable"`
|
||||
Ephemeral LimitBurst `yaml:"ephemeral"`
|
||||
}
|
||||
|
||||
type KindLimitConfig struct {
|
||||
Kind int `yaml:"kind"`
|
||||
Limit float64 `yaml:"limit"`
|
||||
Burst int `yaml:"burst"`
|
||||
}
|
14
config/types/rateLimitConfig.go
Normal file
14
config/types/rateLimitConfig.go
Normal file
@ -0,0 +1,14 @@
|
||||
package config
|
||||
|
||||
type RateLimitConfig struct {
|
||||
WsLimit float64 `yaml:"ws_limit"`
|
||||
WsBurst int `yaml:"ws_burst"`
|
||||
EventLimit float64 `yaml:"event_limit"`
|
||||
EventBurst int `yaml:"event_burst"`
|
||||
ReqLimit float64 `yaml:"req_limit"`
|
||||
ReqBurst int `yaml:"req_burst"`
|
||||
MaxEventSize int `yaml:"max_event_size"`
|
||||
KindSizeLimits []KindSizeLimitConfig `yaml:"kind_size_limits"`
|
||||
CategoryLimits map[string]KindLimitConfig `yaml:"category_limits"`
|
||||
KindLimits []KindLimitConfig `yaml:"kind_limits"`
|
||||
}
|
12
config/types/serverConfig.go
Normal file
12
config/types/serverConfig.go
Normal file
@ -0,0 +1,12 @@
|
||||
package config
|
||||
|
||||
type ServerConfig struct {
|
||||
MongoDB struct {
|
||||
URI string `yaml:"uri"`
|
||||
Database string `yaml:"database"`
|
||||
} `yaml:"mongodb"`
|
||||
Server struct {
|
||||
Port string `yaml:"port"`
|
||||
} `yaml:"server"`
|
||||
RateLimit RateLimitConfig `yaml:"rate_limit"`
|
||||
}
|
Loading…
Reference in New Issue
Block a user