Skip to content

Commit 611d9d0

Browse files
committed
Add config options as CLI arguments
1 parent 5a4bf28 commit 611d9d0

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tuktuk-crank-turner/src/main.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ pub struct Cli {
5353
default_value = "~/.config/helium/cli/tuktuk-crank-turner/config.toml"
5454
)]
5555
pub config: Option<path::PathBuf>,
56+
57+
/// RPC endpoint URL
58+
#[clap(short = 'u', long)]
59+
pub rpc_url: Option<String>,
60+
61+
/// Path to Solana keypair file
62+
#[clap(short = 'k', long)]
63+
pub key_path: Option<String>,
64+
65+
/// Minimum crank fee in lamports
66+
#[clap(short = 'm', long)]
67+
pub min_crank_fee: Option<u64>,
5668
}
5769

5870
impl Cli {
@@ -104,7 +116,19 @@ const PACKED_TX_CHANNEL_CAPACITY: usize = 32;
104116
impl Cli {
105117
pub async fn run(&self) -> Result<()> {
106118
register_custom_metrics();
107-
let settings = Settings::new(self.get_expanded_config_path().as_ref())?;
119+
let mut settings = Settings::new(self.get_expanded_config_path().as_ref())?;
120+
121+
// Apply CLI overrides
122+
if let Some(rpc_url) = &self.rpc_url {
123+
settings.rpc_url = rpc_url.clone();
124+
}
125+
if let Some(key_path) = &self.key_path {
126+
settings.key_path = key_path.clone();
127+
}
128+
if let Some(min_crank_fee) = self.min_crank_fee {
129+
settings.min_crank_fee = min_crank_fee;
130+
}
131+
108132
tracing_subscriber::registry()
109133
.with(tracing_subscriber::EnvFilter::new(&settings.log))
110134
.with(tracing_subscriber::fmt::layer().with_span_events(FmtSpan::CLOSE))

0 commit comments

Comments
 (0)