reddit-magnet/src/notifications/ntfy/config.rs
Marc Plano-Lesay bb32cfdf97
feat!: distinguish URLs and hosts
BREAKING CHANGE: the configuration for Bitmagnet and Ntfy has changed.
Instead of `host`, they now use `url`.
2025-05-22 22:04:22 +10:00

32 lines
801 B
Rust

use crate::app::Enableable;
use crate::config::types::{Password, Topic, Username};
use serde::{Deserialize, Serialize};
use url::Url;
/// Configuration for the ntfy notification service
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NtfyConfig {
/// Whether to enable the ntfy notification service
#[serde(default)]
pub enable: bool,
/// The URL of the ntfy server
pub url: Url,
/// The username for authentication (optional)
#[serde(default)]
pub username: Option<Username>,
/// The password for authentication (optional)
#[serde(default)]
pub password: Option<Password>,
/// The topic to publish notifications to
pub topic: Topic,
}
impl Enableable for NtfyConfig {
fn is_enabled(&self) -> bool {
self.enable
}
}