mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 15:26:36 +08:00
refactor(openflare): remove legacy global API rate limit options
Drop unused GlobalApi/Web/Critical rate limit settings migrated from the old server but never wired up in Wavelet, including validation, defaults, seed data, and a cleanup migration for existing databases.
This commit is contained in:
@@ -108,13 +108,7 @@ var (
|
||||
OpenRestyCacheLockEnabled = true
|
||||
OpenRestyCacheLockTimeout = "5s"
|
||||
OpenRestyCacheUseStale = "error timeout updating http_500 http_502 http_503 http_504"
|
||||
OpenRestyMainConfigTemplate = defaultOpenRestyMainConfigTemplate
|
||||
GlobalApiRateLimitNum = 300
|
||||
GlobalApiRateLimitDuration int64 = 3 * 60
|
||||
GlobalWebRateLimitNum = 300
|
||||
GlobalWebRateLimitDuration int64 = 3 * 60
|
||||
CriticalRateLimitNum = 100
|
||||
CriticalRateLimitDuration int64 = 20 * 60
|
||||
OpenRestyMainConfigTemplate = defaultOpenRestyMainConfigTemplate
|
||||
)
|
||||
|
||||
const defaultOpenRestyMainConfigTemplate = `# This file is generated by OpenFlare. Do not edit manually.
|
||||
@@ -235,13 +229,7 @@ func DefaultOpenFlareOptions() map[string]string {
|
||||
"OpenRestyCacheLockEnabled": strconv.FormatBool(OpenRestyCacheLockEnabled),
|
||||
"OpenRestyCacheLockTimeout": OpenRestyCacheLockTimeout,
|
||||
"OpenRestyCacheUseStale": OpenRestyCacheUseStale,
|
||||
"OpenRestyMainConfigTemplate": OpenRestyMainConfigTemplate,
|
||||
"GlobalApiRateLimitNum": strconv.Itoa(GlobalApiRateLimitNum),
|
||||
"GlobalApiRateLimitDuration": strconv.FormatInt(GlobalApiRateLimitDuration, 10),
|
||||
"GlobalWebRateLimitNum": strconv.Itoa(GlobalWebRateLimitNum),
|
||||
"GlobalWebRateLimitDuration": strconv.FormatInt(GlobalWebRateLimitDuration, 10),
|
||||
"CriticalRateLimitNum": strconv.Itoa(CriticalRateLimitNum),
|
||||
"CriticalRateLimitDuration": strconv.FormatInt(CriticalRateLimitDuration, 10),
|
||||
"OpenRestyMainConfigTemplate": OpenRestyMainConfigTemplate,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,30 +422,6 @@ func applyOptionMap(key, value string) {
|
||||
if v, err := strconv.Atoi(value); err == nil && v >= 1 {
|
||||
DatabaseAutoCleanupRetentionDays = v
|
||||
}
|
||||
case "GlobalApiRateLimitNum":
|
||||
if v, err := strconv.Atoi(value); err == nil && v > 0 {
|
||||
GlobalApiRateLimitNum = v
|
||||
}
|
||||
case "GlobalApiRateLimitDuration":
|
||||
if v, err := strconv.ParseInt(value, 10, 64); err == nil && v > 0 {
|
||||
GlobalApiRateLimitDuration = v
|
||||
}
|
||||
case "GlobalWebRateLimitNum":
|
||||
if v, err := strconv.Atoi(value); err == nil && v > 0 {
|
||||
GlobalWebRateLimitNum = v
|
||||
}
|
||||
case "GlobalWebRateLimitDuration":
|
||||
if v, err := strconv.ParseInt(value, 10, 64); err == nil && v > 0 {
|
||||
GlobalWebRateLimitDuration = v
|
||||
}
|
||||
case "CriticalRateLimitNum":
|
||||
if v, err := strconv.Atoi(value); err == nil && v > 0 {
|
||||
CriticalRateLimitNum = v
|
||||
}
|
||||
case "CriticalRateLimitDuration":
|
||||
if v, err := strconv.ParseInt(value, 10, 64); err == nil && v > 0 {
|
||||
CriticalRateLimitDuration = v
|
||||
}
|
||||
}
|
||||
OptionMapRWMutex.Unlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user