From 22fa5136a88483139166837b1f3d463b311b5ca4 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 11 Nov 2022 19:24:57 +0000 Subject: [PATCH] allow no allowed_origin_requests_per_period --- TODO.md | 2 ++ web3_proxy/src/config.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/TODO.md b/TODO.md index 8fbf8fd6..fcf708ba 100644 --- a/TODO.md +++ b/TODO.md @@ -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 diff --git a/web3_proxy/src/config.rs b/web3_proxy/src/config.rs index 914e9b71..a92670a7 100644 --- a/web3_proxy/src/config.rs +++ b/web3_proxy/src/config.rs @@ -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, /// EVM chain id. 1 for ETH @@ -133,6 +134,10 @@ pub struct AppConfig { pub volatile_redis_max_connections: Option, } +fn default_allowed_origin_requests_per_period() -> HashMap { + HashMap::new() +} + /// This might cause a thundering herd! fn default_min_sum_soft_limit() -> u32 { 1