bin/tau: add default value for rpc_listen

This commit is contained in:
Dastan-glitch
2022-04-29 02:23:47 +03:00
parent cc18f509e8
commit 713a937c6b
2 changed files with 11 additions and 2 deletions

View File

@@ -168,7 +168,10 @@ async fn main() -> Result<()> {
spawn_config(&config_path, CONFIG_FILE_CONTENTS)?;
let config: TauConfig = Config::<TauConfig>::load(config_path)?;
let config: TauConfig = match Config::<TauConfig>::load(config_path) {
Ok(c) => c,
Err(_) => TauConfig::default(),
};
start(args, config).await
}

View File

@@ -2,7 +2,7 @@ use std::{
env::{temp_dir, var},
fs::{self, File},
io::{self, Read, Write},
net::SocketAddr,
net::{IpAddr, Ipv4Addr, SocketAddr},
ops::Index,
process::Command,
};
@@ -24,6 +24,12 @@ pub struct TauConfig {
pub rpc_listen: SocketAddr,
}
impl Default for TauConfig {
fn default() -> Self {
Self { rpc_listen: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 11055) }
}
}
#[derive(Subcommand)]
pub enum CliTauSubCommands {
/// Add a new task