diff --git a/src/config.rs b/src/config.rs index 6298bc3..d2f8f69 100644 --- a/src/config.rs +++ b/src/config.rs @@ -27,6 +27,9 @@ pub(crate) struct Config { #[serde(default = "default_bind_port")] pub(crate) bind_port: u16, + #[serde(default = "default_tokio_console")] + pub(crate) tokio_console: bool, + #[serde(default = "default_certificate")] pub(crate) certificate: Option, @@ -192,6 +195,10 @@ fn default_tls_client_auth() -> String { "none".to_string() } +fn default_tokio_console() -> bool { + false +} + fn default_channel_id() -> u8 { 0 } diff --git a/src/main.rs b/src/main.rs index ae2c2ec..efa9a3c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -58,7 +58,6 @@ fn tokio_console_enable() { #[tokio::main] async fn main() -> Result<()> { env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); - tokio_console_enable(); info!( "Neolink {} {}", @@ -79,6 +78,10 @@ async fn main() -> Result<()> { .validate() .with_context(|| format!("Failed to validate the {:?} config file", conf_path))?; + if config.tokio_console { + tokio_console_enable(); + } + match opt.cmd { None => { warn!(