mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 18:15:39 +00:00
feat: load config to make captcha stats optional
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user