Skip to content

Commit

Permalink
Resolve some new warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Jan 6, 2025
1 parent 00ed130 commit ad26056
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,37 @@ pub struct ConfigNotify {
#[serde(default = "defaults::notify_reminder_backoff_limit")]
pub reminder_backoff_limit: u16,

#[cfg(feature = "notifier-email")]
pub email: Option<ConfigNotifyEmail>,

#[cfg(feature = "notifier-twilio")]
pub twilio: Option<ConfigNotifyTwilio>,

#[cfg(feature = "notifier-slack")]
pub slack: Option<ConfigNotifySlack>,

#[cfg(feature = "notifier-zulip")]
pub zulip: Option<ConfigNotifyZulip>,

#[cfg(feature = "notifier-telegram")]
pub telegram: Option<ConfigNotifyTelegram>,

#[cfg(feature = "notifier-pushover")]
pub pushover: Option<ConfigNotifyPushover>,

#[cfg(feature = "notifier-gotify")]
pub gotify: Option<ConfigNotifyGotify>,

#[cfg(feature = "notifier-xmpp")]
pub xmpp: Option<ConfigNotifyXMPP>,

#[cfg(feature = "notifier-matrix")]
pub matrix: Option<ConfigNotifyMatrix>,

#[cfg(feature = "notifier-webex")]
pub webex: Option<ConfigNotifyWebEx>,

#[cfg(feature = "notifier-webhook")]
pub webhook: Option<ConfigNotifyWebHook>,
}

Expand Down Expand Up @@ -162,6 +183,7 @@ pub struct ConfigPluginsRabbitMQ {
pub queue_loaded_retry_delay: Option<u64>,
}

#[cfg(feature = "notifier-email")]
#[derive(Deserialize)]
pub struct ConfigNotifyEmail {
pub to: String,
Expand All @@ -183,6 +205,7 @@ pub struct ConfigNotifyEmail {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-twilio")]
#[derive(Deserialize)]
pub struct ConfigNotifyTwilio {
pub to: Vec<String>,
Expand All @@ -194,6 +217,7 @@ pub struct ConfigNotifyTwilio {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-slack")]
#[derive(Deserialize)]
pub struct ConfigNotifySlack {
pub hook_url: SerdeUrl,
Expand All @@ -205,6 +229,7 @@ pub struct ConfigNotifySlack {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-zulip")]
#[derive(Deserialize)]
pub struct ConfigNotifyZulip {
pub bot_email: String,
Expand All @@ -216,6 +241,7 @@ pub struct ConfigNotifyZulip {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-telegram")]
#[derive(Deserialize)]
pub struct ConfigNotifyTelegram {
pub bot_token: String,
Expand All @@ -225,6 +251,7 @@ pub struct ConfigNotifyTelegram {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-pushover")]
#[derive(Deserialize)]
pub struct ConfigNotifyPushover {
pub app_token: String,
Expand All @@ -234,6 +261,7 @@ pub struct ConfigNotifyPushover {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-gotify")]
#[derive(Deserialize)]
pub struct ConfigNotifyGotify {
pub app_url: SerdeUrl,
Expand All @@ -243,6 +271,7 @@ pub struct ConfigNotifyGotify {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-xmpp")]
#[derive(Deserialize)]
pub struct ConfigNotifyXMPP {
pub to: String,
Expand All @@ -253,6 +282,7 @@ pub struct ConfigNotifyXMPP {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-matrix")]
#[derive(Deserialize)]
pub struct ConfigNotifyMatrix {
pub homeserver_url: SerdeUrl,
Expand All @@ -263,6 +293,7 @@ pub struct ConfigNotifyMatrix {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-webex")]
#[derive(Deserialize)]
pub struct ConfigNotifyWebEx {
pub endpoint_url: SerdeUrl,
Expand All @@ -273,6 +304,7 @@ pub struct ConfigNotifyWebEx {
pub reminders_only: bool,
}

#[cfg(feature = "notifier-webhook")]
#[derive(Deserialize)]
pub struct ConfigNotifyWebHook {
pub hook_url: SerdeUrl,
Expand Down
4 changes: 4 additions & 0 deletions src/config/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,22 @@ pub fn notify_reminder_backoff_limit() -> u16 {
3
}

#[cfg(feature = "notifier-email")]
pub fn notify_email_smtp_host() -> String {
"localhost".to_string()
}

#[cfg(feature = "notifier-email")]
pub fn notify_email_smtp_port() -> u16 {
587
}

#[cfg(feature = "notifier-email")]
pub fn notify_email_smtp_encrypt() -> bool {
true
}

#[cfg(feature = "notifier-slack")]
pub fn notify_slack_mention_channel() -> bool {
false
}
Expand Down

0 comments on commit ad26056

Please sign in to comment.