Modifications to rate limiting settings. (#4091)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
dff985a924
Коммит
7fcc004beb
@@ -177,11 +177,12 @@ type EmailSettings struct {
|
||||
}
|
||||
|
||||
type RateLimitSettings struct {
|
||||
EnableRateLimiter bool
|
||||
PerSec int
|
||||
MemoryStoreSize int
|
||||
VaryByRemoteAddr bool
|
||||
VaryByHeader string
|
||||
Enable *bool
|
||||
PerSec int
|
||||
MaxBurst *int
|
||||
MemoryStoreSize int
|
||||
VaryByRemoteAddr bool
|
||||
VaryByHeader string
|
||||
}
|
||||
|
||||
type PrivacySettings struct {
|
||||
@@ -894,6 +895,16 @@ func (o *Config) SetDefaults() {
|
||||
*o.NativeAppSettings.IosAppDownloadLink = "https://about.mattermost.com/mattermost-ios-app/"
|
||||
}
|
||||
|
||||
if o.RateLimitSettings.Enable == nil {
|
||||
o.RateLimitSettings.Enable = new(bool)
|
||||
*o.RateLimitSettings.Enable = false
|
||||
}
|
||||
|
||||
if o.RateLimitSettings.MaxBurst == nil {
|
||||
o.RateLimitSettings.MaxBurst = new(int)
|
||||
*o.RateLimitSettings.MaxBurst = 100
|
||||
}
|
||||
|
||||
o.defaultWebrtcSettings()
|
||||
}
|
||||
|
||||
@@ -1097,6 +1108,10 @@ func (o *Config) IsValid() *AppError {
|
||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.sitename_length.app_error", map[string]interface{}{"MaxLength": SITENAME_MAX_LENGTH}, "")
|
||||
}
|
||||
|
||||
if *o.RateLimitSettings.MaxBurst <= 0 {
|
||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.max_burst.app_error", nil, "")
|
||||
}
|
||||
|
||||
if err := o.isValidWebrtcSettings(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user