clean up rpc_key_id template change

This commit is contained in:
Bryan Stitt 2022-11-10 22:17:22 +00:00
parent 23e978a66c
commit 2c4586302d
6 changed files with 16 additions and 7 deletions

View File

@ -230,6 +230,7 @@ These are roughly in order of completition
- [x] /status should include the server weights
- [-] add configurable size limits to all the Caches
- instead of configuring each cache with MB sizes, have one value for total memory footprint and then percentages for each cache
- [ ] test that runs check_config against example.toml
- [ ] actually block unauthenticated requests instead of emitting warning of "allowing without auth during development!"

View File

@ -13,7 +13,7 @@ volatile_redis_max_connections = 300
volatile_redis_url = "redis://REDIS_DOMAIN:REDIS_PORT/"
redirect_public_url = "https://llamanodes.com/public-rpc"
redirect_user_url = "https://llamanodes.com/dashboard/keys?key={{rpc_key_id}}"
redirect_user_url = "https://llamanodes.com/dashboard/keys?key={rpc_key_id}"
sentry_url = "https://SENTRY_KEY_A.ingest.sentry.io/SENTRY_KEY_B"

View File

@ -195,7 +195,7 @@ impl Web3ProxyApp {
// safety checks on the config
if let Some(redirect) = &top_config.app.redirect_user_url {
assert!(
redirect.contains("{{rpc_key_id}}"),
redirect.contains("{rpc_key_id}"),
"redirect_user_url user url must contain \"{{rpc_key_id}}\""
);
}

View File

@ -283,7 +283,7 @@ mod tests {
public_requests_per_period: Some(1_000_000),
response_cache_max_bytes: 10_usize.pow(7),
redirect_public_url: Some("example.com/".to_string()),
redirect_user_url: Some("example.com/{{user_id}}".to_string()),
redirect_user_url: Some("example.com/{{rpc_key_id}}".to_string()),
..Default::default()
},
balanced_rpcs: HashMap::from([

View File

@ -1,6 +1,6 @@
use argh::FromArgs;
use std::fs;
use tracing::{info, warn};
use tracing::{error, info, warn};
use web3_proxy::config::TopConfig;
#[derive(FromArgs, PartialEq, Eq, Debug)]
@ -65,8 +65,16 @@ impl CheckConfigSubCommand {
warn!("app.redirect_public_url is None. Anonyoumous users will get an error page instead of a redirect")
}
if top_config.app.redirect_user_url.is_none() {
warn!("app.redirect_user_url is None. Registered users will get an error page instead of a redirect")
// TODO: also check that it contains rpc_key_id!
match top_config.app.redirect_user_url {
None => {
warn!("app.redirect_user_url is None. Registered users will get an error page instead of a redirect")
}
Some(x) => {
if !x.contains("{rpc_key_id}") {
error!("redirect_user_url user url must contain \"{{rpc_key_id}}\"")
}
}
}
Ok(())

View File

@ -117,7 +117,7 @@ pub struct AppConfig {
/// the stats page url for an anonymous user.
pub redirect_public_url: Option<String>,
/// the stats page url for a logged in user. if set, must contain "{user_id}"
/// the stats page url for a logged in user. if set, must contain "{rpc_key_id}"
pub redirect_user_url: Option<String>,
/// Optionally send errors to <https://sentry.io>