From e2602b5c1774e56e0a776d3c7add9ac5c87b3688 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Wed, 3 May 2023 18:17:05 +0700 Subject: [PATCH] Add tokio console to the config --- src/config.rs | 7 +++++++ src/main.rs | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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!(