mirror of
https://github.com/chatmail/relay.git
synced 2026-08-24 17:13:14 +00:00
chore(tests): Add a way to disable DKIM for tests (#50)
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
This commit is contained in:
committed by
GitHub
parent
4eb7e9fd63
commit
6e2a37956c
@@ -15,13 +15,15 @@ use std::str::FromStr;
|
||||
pub struct IncomingBeforeQueueHandler {
|
||||
config: Config,
|
||||
dkim_verifier: DkimVerifier,
|
||||
skip_dkim: bool,
|
||||
}
|
||||
|
||||
impl IncomingBeforeQueueHandler {
|
||||
pub fn new(config: Config) -> Result<Self, crate::error::Error> {
|
||||
pub fn new(config: Config, skip_dkim: bool) -> Result<Self, crate::error::Error> {
|
||||
Ok(Self {
|
||||
config,
|
||||
dkim_verifier: DkimVerifier::new()?,
|
||||
skip_dkim,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -67,7 +69,9 @@ impl SmtpHandler for IncomingBeforeQueueHandler {
|
||||
}
|
||||
}
|
||||
AddressDomain::Name(domain) => {
|
||||
self.dkim_verifier.verify(&envelope.data, &domain).await?;
|
||||
if !self.skip_dkim {
|
||||
self.dkim_verifier.verify(&envelope.data, &domain).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user