pub struct NotificationConfig {
pub mail: Option<MailConfig>,
pub slack_webhook: Option<String>,
}Expand description
Configuration for the notification dispatcher.
Fields§
§mail: Option<MailConfig>Mail configuration (supports SMTP and Resend drivers).
slack_webhook: Option<String>Slack webhook URL.
Implementations§
Source§impl NotificationConfig
impl NotificationConfig
Sourcepub fn new() -> NotificationConfig
pub fn new() -> NotificationConfig
Create a new notification config.
Sourcepub fn from_env() -> NotificationConfig
pub fn from_env() -> NotificationConfig
Create configuration from environment variables.
Reads the following environment variables:
- Mail:
MAIL_HOST,MAIL_PORT,MAIL_USERNAME,MAIL_PASSWORD,MAIL_FROM_ADDRESS,MAIL_FROM_NAME,MAIL_ENCRYPTION - Slack:
SLACK_WEBHOOK_URL
§Example
ⓘ
use ferro_notifications::NotificationConfig;
// In bootstrap.rs
let config = NotificationConfig::from_env();
NotificationDispatcher::configure(config);Sourcepub fn mail(self, config: MailConfig) -> NotificationConfig
pub fn mail(self, config: MailConfig) -> NotificationConfig
Set the mail configuration.
Sourcepub fn slack_webhook(self, url: impl Into<String>) -> NotificationConfig
pub fn slack_webhook(self, url: impl Into<String>) -> NotificationConfig
Set the Slack webhook URL.
Trait Implementations§
Source§impl Clone for NotificationConfig
impl Clone for NotificationConfig
Source§fn clone(&self) -> NotificationConfig
fn clone(&self) -> NotificationConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for NotificationConfig
impl Default for NotificationConfig
Source§fn default() -> NotificationConfig
fn default() -> NotificationConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NotificationConfig
impl RefUnwindSafe for NotificationConfig
impl Send for NotificationConfig
impl Sync for NotificationConfig
impl Unpin for NotificationConfig
impl UnsafeUnpin for NotificationConfig
impl UnwindSafe for NotificationConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more