neon_arch commited on
Commit
d4df901
1 Parent(s): 141aacc

feat: add an option to enable/disable debug mode

Browse files
src/bin/websurfx.rs CHANGED
@@ -19,7 +19,7 @@ async fn main() -> std::io::Result<()> {
19
  let config = Config::parse().unwrap();
20
 
21
  // Initializing logging middleware with level set to default or info.
22
- if config.logging {
23
  use env_logger::Env;
24
  env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
25
  }
 
19
  let config = Config::parse().unwrap();
20
 
21
  // Initializing logging middleware with level set to default or info.
22
+ if config.logging || config.debug{
23
  use env_logger::Env;
24
  env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
25
  }
src/config_parser/parser.rs CHANGED
@@ -26,6 +26,7 @@ pub struct Config {
26
  pub redis_connection_url: String,
27
  pub aggregator: AggreatorConfig,
28
  pub logging: bool,
 
29
  }
30
 
31
  /// Configuration options for the aggregator.
@@ -73,6 +74,7 @@ impl Config {
73
  redis_connection_url: globals.get::<_, String>("redis_connection_url")?,
74
  aggregator: aggregator_config,
75
  logging: globals.get::<_, bool>("logging")?,
 
76
  })
77
  })
78
  }
 
26
  pub redis_connection_url: String,
27
  pub aggregator: AggreatorConfig,
28
  pub logging: bool,
29
+ pub debug: bool,
30
  }
31
 
32
  /// Configuration options for the aggregator.
 
74
  redis_connection_url: globals.get::<_, String>("redis_connection_url")?,
75
  aggregator: aggregator_config,
76
  logging: globals.get::<_, bool>("logging")?,
77
+ debug: globals.get::<_, bool>("debug")?,
78
  })
79
  })
80
  }
websurfx/config.lua CHANGED
@@ -1,5 +1,6 @@
1
  -- ### General ###
2
  logging = true -- an option to enable or disable logs.
 
3
 
4
  -- ### Server ###
5
  port = "8080" -- port on which server should be launched
 
1
  -- ### General ###
2
  logging = true -- an option to enable or disable logs.
3
+ debug = false -- an option to enable or disable debug mode.
4
 
5
  -- ### Server ###
6
  port = "8080" -- port on which server should be launched