diff --git a/src/config/mod.rs b/src/config/mod.rs index 4beccc68..9fc0e4cc 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -11,7 +11,7 @@ use itertools::Itertools; use regex::RegexSet; use ruma::{OwnedServerName, RoomVersionId}; use serde::{de::IgnoredAny, Deserialize}; -use tracing::{error, warn}; +use tracing::{debug, error, warn}; mod proxy; @@ -157,6 +157,7 @@ const DEPRECATED_KEYS: &[&str] = &["cache_capacity"]; impl Config { /// Iterates over all the keys in the config file and warns if there is a deprecated key specified pub fn warn_deprecated(&self) { + debug!("Checking for deprecated config keys"); let mut was_deprecated = false; for key in self .catchall @@ -172,6 +173,14 @@ impl Config { } } + /// iterates over all the catchall keys (unknown config options) and warns if there are any. + pub fn warn_unknown_key(&self) { + debug!("Checking for unknown config keys"); + for key in self.catchall.keys() { + warn!("Config parameter \"{}\" is unknown to conduwuit.", key); + } + } + /// Checks the presence of the `address` and `unix_socket_path` keys in the raw_config, exiting the process if both keys were detected. pub fn is_dual_listening(&self, raw_config: Figment) -> bool { let check_address = raw_config.find_value("address"); diff --git a/src/main.rs b/src/main.rs index 38339206..05db3af8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -136,6 +136,9 @@ async fn main() { maximize_fd_limit().expect("Unable to increase maximum soft and hard file descriptor limit"); config.warn_deprecated(); + config.warn_unknown_key(); + + // don't start if we're listening on both UNIX sockets and TCP at same time if config.is_dual_listening(raw_config) { return; };