allow no allowed_origin_requests_per_period

This commit is contained in:
Bryan Stitt 2022-11-11 19:24:57 +00:00
parent 1329084621
commit 22fa5136a8
2 changed files with 7 additions and 0 deletions

View File

@ -245,6 +245,8 @@ These are roughly in order of completition
These are not yet ordered. There might be duplicates. We might not actually need all of these.
- [ ] remove the "metered" crate now that we save aggregate queries?
- [ ] remove/change the "active_requests" counter? maybe only once we have dynamic soft limits?
- [ ] refactor so configs can change while running
- this will probably be a rather large change, but is necessary when we have autoscaling
- create the app without applying any config to it

View File

@ -54,6 +54,7 @@ pub struct TopConfig {
pub struct AppConfig {
/// Request limit for allowed origins for anonymous users.
/// These requests get rate limited by IP.
#[serde(default = "default_allowed_origin_requests_per_period")]
pub allowed_origin_requests_per_period: HashMap<String, u64>,
/// EVM chain id. 1 for ETH
@ -133,6 +134,10 @@ pub struct AppConfig {
pub volatile_redis_max_connections: Option<usize>,
}
fn default_allowed_origin_requests_per_period() -> HashMap<String, u64> {
HashMap::new()
}
/// This might cause a thundering herd!
fn default_min_sum_soft_limit() -> u32 {
1