read SMTP configuration

This commit is contained in:
realaravinth
2021-06-29 21:08:40 +05:30
parent 481cb95cd2
commit 804c81da38
6 changed files with 391 additions and 16 deletions

View File

@@ -38,6 +38,14 @@ pub struct Captcha {
pub gc: u64,
}
#[derive(Debug, Clone, Deserialize)]
pub struct Smtp {
pub from: String,
pub url: String,
pub username: String,
pub password: String,
}
impl Server {
#[cfg(not(tarpaulin_include))]
pub fn get_ip(&self) -> String {
@@ -93,6 +101,7 @@ pub struct Settings {
pub server: Server,
pub pow: Captcha,
pub source_code: String,
pub smtp: Option<Smtp>,
}
#[cfg(not(tarpaulin_include))]
@@ -206,4 +215,12 @@ fn set_database_url(s: &mut Config) {
// settings.server.check_url_prefix();
// assert!(settings.server.url_prefix.is_none());
// }
//
// #[test]
// fn smtp_config_works() {
// let settings = Settings::new().unwrap();
// assert!(settings.smtp.is_some());
// assert_eq!(settings.smtp.as_ref().unwrap().password, "password");
// assert_eq!(settings.smtp.as_ref().unwrap().username, "admin");
// }
//}