mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
cln-grpc: Do not start unless a grpc-port is specified
For now we don't want to autostart. Suggested-by: Rusty Russell <@rustyrussell>
This commit is contained in:
committed by
Rusty Russell
parent
bf7ad86ef2
commit
09ee28cb51
@@ -31,13 +31,17 @@ async fn main() -> Result<()> {
|
||||
let plugin = Builder::new(state.clone(), tokio::io::stdin(), tokio::io::stdout())
|
||||
.option(options::ConfigOption::new(
|
||||
"grpc-port",
|
||||
options::Value::Integer(50051),
|
||||
options::Value::Integer(-1),
|
||||
"Which port should the grpc plugin listen for incoming connections?",
|
||||
))
|
||||
.start()
|
||||
.await?;
|
||||
|
||||
let bind_port = match plugin.option("grpc-port") {
|
||||
Some(options::Value::Integer(-1)) => {
|
||||
log::info!("`grpc-port` option is not configured, exiting.");
|
||||
return Ok(());
|
||||
}
|
||||
Some(options::Value::Integer(i)) => i,
|
||||
None => return Err(anyhow!("Missing 'grpc-port' option")),
|
||||
Some(o) => return Err(anyhow!("grpc-port is not a valid integer: {:?}", o)),
|
||||
|
||||
Reference in New Issue
Block a user