From fc38fbc800071ca0bddf8d15714b8eb6df17d750 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Sun, 28 Apr 2024 18:03:00 +0200 Subject: [PATCH] add settings for Notifier (webhook & smtp) --- Cargo.toml | 2 +- src/lib.rs | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 727e122..7388407 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "twba-backup-config" -version = "0.1.6" +version = "0.1.7" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/lib.rs b/src/lib.rs index bb3e25c..28f713a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,6 +20,8 @@ pub struct Conf { #[config(default = 5)] pub max_items_to_process: u64, + #[config(nested)] + pub notifier: Notifier, #[config(nested)] pub twitch: Twitch, #[config(nested)] @@ -48,6 +50,29 @@ impl Conf { PathBuf::from(path) } } + +#[derive(Debug, Serialize, Deserialize, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Config)] +pub struct Notifier { + /// The URL for the webhook + pub webhook_url: Option, + pub smtp: Option, +} +#[derive(Debug, Serialize, Deserialize, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Config)] +pub struct Smtp { + /// The SMTP server address + pub server: String, + /// The SMTP server port + pub port: u16, + /// The SMTP username + pub username: String, + /// The SMTP password + pub password: String, + /// The email address to send the email from + pub from: String, + /// The email address to send the email to + pub to: String, +} + #[derive(Debug, Serialize, Deserialize, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Config)] pub struct Google { /// The path for the auth code file.