From 15cfeef84dd7644eed48b3dfd79813ebdba9f83c Mon Sep 17 00:00:00 2001 From: nazeh Date: Thu, 13 Feb 2025 13:08:24 +0300 Subject: [PATCH] fix(pubky): testnet hardcoded configurations --- examples/authz/authenticator.rs | 8 +++++--- pubky/src/native.rs | 12 ++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/examples/authz/authenticator.rs b/examples/authz/authenticator.rs index 9147c92..284b782 100644 --- a/examples/authz/authenticator.rs +++ b/examples/authz/authenticator.rs @@ -18,8 +18,9 @@ struct Cli { /// Pubky Auth url url: Url, - // Whether or not to use testnet Dht network (local testing) - testnet: Option, + /// Use testnet mode + #[clap(long)] + testnet: bool, } #[tokio::main] @@ -65,7 +66,8 @@ async fn main() -> Result<()> { println!("Successfully decrypted recovery file..."); println!("PublicKey: {}", keypair.public_key()); - let client = if cli.testnet.unwrap_or_default() { + let client = if cli.testnet { + dbg!("HERE"); let client = Client::builder().testnet().build()?; // For the purposes of this demo, we need to make sure diff --git a/pubky/src/native.rs b/pubky/src/native.rs index 6826b8c..891aa45 100644 --- a/pubky/src/native.rs +++ b/pubky/src/native.rs @@ -43,8 +43,16 @@ impl ClientBuilder { /// 2. Pkarr Relay running on port [15411][pubky_common::constants::testnet_ports::PKARR_RELAY] pub fn testnet(&mut self) -> &mut Self { self.pkarr - .bootstrap(&["localhost:6881"]) - .relays(&["http://localhost:5411"]) + .bootstrap(&[format!( + "localhost:{}", + // TODO: update constants + // pubky_common::constants::testnet_ports::BOOTSTRAP + 6881 + )]) + .relays(&[format!( + "http://localhost:{}", + pubky_common::constants::testnet_ports::PKARR_RELAY + )]) .expect("relays urls infallible"); self