pub struct NotificationConfig {
pub mail: Option<MailConfig>,
pub slack_webhook: Option<String>,
pub whatsapp_enabled: bool,
pub in_app: Option<InAppConfig>,
pub database_store: Option<Arc<dyn DatabaseNotificationStore>>,
}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.
whatsapp_enabled: boolEnable the WhatsApp channel (per CONTEXT.md D-04).
Defaults to false. When true, the dispatcher calls
ferro_whatsapp::WhatsApp::send which requires that
ferro_whatsapp::WhatsApp::init was called at app startup.
in_app: Option<InAppConfig>In-app SSE channel configuration (per CONTEXT.md D-07).
When Some, Channel::InApp dispatches persist via store then publish via broker.
When None, Channel::InApp emits a structured “channel not configured” no-op.
database_store: Option<Arc<dyn DatabaseNotificationStore>>Database notification store (per CONTEXT.md D-13, closes ARCH-FINDING-02).
When Some, Channel::Database calls store.store(...) instead of the placeholder log.
When None, the existing placeholder behavior is preserved (backward-compat).
Note: InAppConfig.store is independent of this field — they may point to the same Arc
or to different stores.
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.
Sourcepub fn with_whatsapp_enabled(self, enabled: bool) -> NotificationConfig
pub fn with_whatsapp_enabled(self, enabled: bool) -> NotificationConfig
Enable or disable the WhatsApp channel.
Sourcepub fn with_in_app(self, config: InAppConfig) -> NotificationConfig
pub fn with_in_app(self, config: InAppConfig) -> NotificationConfig
Set the in-app channel configuration (per CONTEXT.md D-07).
Sourcepub fn with_database_store(
self,
store: Arc<dyn DatabaseNotificationStore>,
) -> NotificationConfig
pub fn with_database_store( self, store: Arc<dyn DatabaseNotificationStore>, ) -> NotificationConfig
Set the database notification store (per CONTEXT.md D-13).
When configured, Channel::Database dispatches call store.store(...)
instead of the placeholder log path.
Trait Implementations§
Source§impl Clone for NotificationConfig
impl Clone for NotificationConfig
Source§fn clone(&self) -> NotificationConfig
fn clone(&self) -> NotificationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for NotificationConfig
impl Default for NotificationConfig
Source§fn default() -> NotificationConfig
fn default() -> NotificationConfig
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
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>
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>
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