1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-29 08:46:27 +00:00

Add verbose mode configuration option

This commit is contained in:
Pierre HUBERT 2021-02-06 16:38:51 +01:00
parent 25d83db840
commit bc8cda78ae
3 changed files with 8 additions and 2 deletions

View File

@ -20,6 +20,9 @@ force-https: true
storage-url: http://devweb.local/comunic/current/user_data/ storage-url: http://devweb.local/comunic/current/user_data/
storage-path: /home/pierre/Documents/projets_web/comunic/current/user_data/ storage-path: /home/pierre/Documents/projets_web/comunic/current/user_data/
# Print more information to the console
verbose-mode: true
# Database configuration # Database configuration
database: database:
host: localhost host: localhost

View File

@ -355,7 +355,7 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for WsSession {
Ok(msg) => msg, Ok(msg) => msg,
}; };
if conf().database.log_all_queries if conf().verbose_mode
{ {
println!("USER WEBSOCKET MESSAGE: {:?}", msg); println!("USER WEBSOCKET MESSAGE: {:?}", msg);
} }
@ -376,7 +376,7 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for WsSession {
let response = serde_json::to_string(&msg) let response = serde_json::to_string(&msg)
.unwrap_or("Failed to serialize".to_string()); .unwrap_or("Failed to serialize".to_string());
if conf().database.log_all_queries { if conf().verbose_mode {
println!("USER WEBSOCKET RESPONSE {}", response); println!("USER WEBSOCKET RESPONSE {}", response);
} }

View File

@ -23,6 +23,7 @@ pub struct Config {
pub database: DatabaseConfig, pub database: DatabaseConfig,
pub proxy: Option<String>, pub proxy: Option<String>,
pub force_https: bool, pub force_https: bool,
pub verbose_mode: bool,
} }
/// Globally available configuration /// Globally available configuration
@ -80,6 +81,8 @@ impl Config {
}, },
force_https: Config::yaml_bool(parsed, "force-https"), force_https: Config::yaml_bool(parsed, "force-https"),
verbose_mode: Config::yaml_bool(parsed, "verbose-mode"),
}; };
// Save new configuration in memory // Save new configuration in memory