0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-21 21:48:21 -05:00

feat: add an option to enable/disable debug mode

This commit is contained in:
neon_arch 2023-05-29 21:09:07 +03:00
parent 141aacc82a
commit d4df90160d
3 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,7 @@ async fn main() -> std::io::Result<()> {
let config = Config::parse().unwrap(); let config = Config::parse().unwrap();
// Initializing logging middleware with level set to default or info. // Initializing logging middleware with level set to default or info.
if config.logging { if config.logging || config.debug{
use env_logger::Env; use env_logger::Env;
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
} }

View File

@ -26,6 +26,7 @@ pub struct Config {
pub redis_connection_url: String, pub redis_connection_url: String,
pub aggregator: AggreatorConfig, pub aggregator: AggreatorConfig,
pub logging: bool, pub logging: bool,
pub debug: bool,
} }
/// Configuration options for the aggregator. /// Configuration options for the aggregator.
@ -73,6 +74,7 @@ impl Config {
redis_connection_url: globals.get::<_, String>("redis_connection_url")?, redis_connection_url: globals.get::<_, String>("redis_connection_url")?,
aggregator: aggregator_config, aggregator: aggregator_config,
logging: globals.get::<_, bool>("logging")?, logging: globals.get::<_, bool>("logging")?,
debug: globals.get::<_, bool>("debug")?,
}) })
}) })
} }

View File

@ -1,5 +1,6 @@
-- ### General ### -- ### General ###
logging = true -- an option to enable or disable logs. logging = true -- an option to enable or disable logs.
debug = false -- an option to enable or disable debug mode.
-- ### Server ### -- ### Server ###
port = "8080" -- port on which server should be launched port = "8080" -- port on which server should be launched