use crate::AppConfig; impl AppConfig { pub fn smtp_host(&self) -> anyhow::Result { if let Some(host) = self.env.get("APP_SMTP_HOST") { return Ok(host.to_string()); } Err(anyhow::anyhow!("APP_SMTP_HOST not found")) } pub fn smtp_port(&self) -> anyhow::Result { if let Some(port) = self.env.get("APP_SMTP_PORT") { return Ok(port.parse::()?); } Ok(587) } pub fn smtp_username(&self) -> anyhow::Result { if let Some(username) = self.env.get("APP_SMTP_USERNAME") { return Ok(username.to_string()); } Err(anyhow::anyhow!("APP_SMTP_USERNAME not found")) } pub fn smtp_password(&self) -> anyhow::Result { if let Some(password) = self.env.get("APP_SMTP_PASSWORD") { return Ok(password.to_string()); } Err(anyhow::anyhow!("APP_SMTP_PASSWORD not found")) } pub fn smtp_from(&self) -> anyhow::Result { if let Some(from) = self.env.get("APP_SMTP_FROM") { return Ok(from.to_string()); } Err(anyhow::anyhow!("APP_SMTP_FROM not found")) } pub fn smtp_tls(&self) -> anyhow::Result { if let Some(tls) = self.env.get("APP_SMTP_TLS") { return Ok(tls.parse::()?); } Ok(true) } pub fn smtp_timeout(&self) -> anyhow::Result { if let Some(timeout) = self.env.get("APP_SMTP_TIMEOUT") { return Ok(timeout.parse::()?); } Ok(30) } }