From c0ab400af680e4b791ae012502fa831813eae444 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Wed, 25 Jan 2023 17:58:10 -0800 Subject: [PATCH] add create_key cli command --- TODO.md | 1 + web3_proxy/src/bin/web3_proxy_cli/main.rs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/TODO.md b/TODO.md index 231b7839..f115d336 100644 --- a/TODO.md +++ b/TODO.md @@ -323,6 +323,7 @@ These are not yet ordered. There might be duplicates. We might not actually need - [x] don't send pagerduty alerts for websocket panics - [x] improve waiting for sync when rate limited - [x] improve pager duty errors for smarter deduping +- [x] add create_key cli command - [-] proxy mode for benchmarking all backends - [-] proxy mode for sending to multiple backends - [-] let users choose a % of reverts to log (or maybe x/second). someone like curve logging all reverts will be a BIG database very quickly diff --git a/web3_proxy/src/bin/web3_proxy_cli/main.rs b/web3_proxy/src/bin/web3_proxy_cli/main.rs index 852334f9..0b8dbe3a 100644 --- a/web3_proxy/src/bin/web3_proxy_cli/main.rs +++ b/web3_proxy/src/bin/web3_proxy_cli/main.rs @@ -4,6 +4,7 @@ mod change_user_tier_by_address; mod change_user_tier_by_key; mod check_config; mod count_users; +mod create_key; mod create_user; mod daemon; mod drop_migration_lock; @@ -73,6 +74,7 @@ enum SubCommand { ChangeUserTierByKey(change_user_tier_by_key::ChangeUserTierByKeySubCommand), CheckConfig(check_config::CheckConfigSubCommand), CountUsers(count_users::CountUsersSubCommand), + CreateKey(create_key::CreateKeySubCommand), CreateUser(create_user::CreateUserSubCommand), DropMigrationLock(drop_migration_lock::DropMigrationLockSubCommand), Pagerduty(pagerduty::PagerdutySubCommand), @@ -310,6 +312,15 @@ fn main() -> anyhow::Result<()> { x.main(&db_conn).await } SubCommand::CheckConfig(x) => x.main().await, + SubCommand::CreateKey(x) => { + let db_url = cli_config + .db_url + .expect("'--config' (with a db) or '--db-url' is required to run create a key"); + + let db_conn = get_migrated_db(db_url, 1, 1).await?; + + x.main(&db_conn).await + } SubCommand::CreateUser(x) => { let db_url = cli_config .db_url