mirror of
https://github.com/chatmail/relay.git
synced 2026-08-11 11:00:52 +00:00
fix(config): Set default values for internal SMTP ports and max message size (#12)
Fixes: #7 Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
This commit is contained in:
committed by
GitHub
parent
41e9e9f6d0
commit
2b4205a60a
@@ -6,10 +6,15 @@ use std::path::{Path, PathBuf};
|
||||
/// Chatmail configuration subset used by filtermail.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct Config {
|
||||
#[serde(default = "Config::default_filtermail_smtp_port")]
|
||||
pub filtermail_smtp_port: u16,
|
||||
#[serde(default = "Config::default_filtermail_smtp_port_incoming")]
|
||||
pub filtermail_smtp_port_incoming: u16,
|
||||
#[serde(default = "Config::default_postfix_reinject_port")]
|
||||
pub postfix_reinject_port: u16,
|
||||
#[serde(default = "Config::default_postfix_reinject_port_incoming")]
|
||||
pub postfix_reinject_port_incoming: u16,
|
||||
#[serde(default = "Config::default_max_message_size")]
|
||||
pub max_message_size: usize,
|
||||
pub max_user_send_per_minute: usize,
|
||||
#[serde(default, deserialize_with = "deserialize_sequence")]
|
||||
@@ -50,7 +55,7 @@ impl Config {
|
||||
Ok(wrapped_config.params)
|
||||
}
|
||||
|
||||
/// Get the mailboxes directory, using defaulting to `/home/vmail/mail/<mail_domain>` if not set.
|
||||
/// Get the mailboxes directory, defaulting to `/home/vmail/mail/<mail_domain>` if not set.
|
||||
fn mailboxes_dir(&self) -> PathBuf {
|
||||
match &self.mailboxes_dir {
|
||||
Some(dir) => dir.clone(),
|
||||
@@ -70,4 +75,22 @@ impl Config {
|
||||
|
||||
!enforce_e2ee.exists()
|
||||
}
|
||||
|
||||
// Following are needed since serde does not support default literals.
|
||||
|
||||
const fn default_filtermail_smtp_port() -> u16 {
|
||||
10080
|
||||
}
|
||||
const fn default_filtermail_smtp_port_incoming() -> u16 {
|
||||
10081
|
||||
}
|
||||
const fn default_postfix_reinject_port() -> u16 {
|
||||
10025
|
||||
}
|
||||
const fn default_postfix_reinject_port_incoming() -> u16 {
|
||||
10026
|
||||
}
|
||||
const fn default_max_message_size() -> usize {
|
||||
31457280
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user