diff --git a/config/default.toml b/config/default.toml index 93b88cd0..210da8dc 100644 --- a/config/default.toml +++ b/config/default.toml @@ -28,6 +28,7 @@ salt = "asdl;kjfhjawehfpa;osdkjasdvjaksndfpoanjdfainsdfaijdsfajlkjdsaf;ajsdfwero # garbage collection period to manage mCaptcha system # leave untouched if you don't know what you are doing gc = 30 +enable_stats = true [captcha.default_difficulty_strategy] avg_traffic_difficulty = 50000 # almost instant solution diff --git a/src/settings.rs b/src/settings.rs index ee71cfdf..67c5f439 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -36,6 +36,7 @@ pub struct Server { pub struct Captcha { pub salt: String, pub gc: u64, + pub enable_stats: bool, pub default_difficulty_strategy: DefaultDifficultyStrategy, } @@ -124,6 +125,9 @@ impl Settings { const CURRENT_DIR: &str = "./config/default.toml"; const ETC: &str = "/etc/mcaptcha/config.toml"; + s.set("capatcha.enable_stats", true.to_string()) + .expect("unable to set capatcha.enable_stats default config"); + if let Ok(path) = env::var("MCAPTCHA_CONFIG") { s.merge(File::with_name(&path))?; } else if Path::new(CURRENT_DIR).exists() {