mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 13:16:56 +00:00
refactor: cleaned up code
This commit is contained in:
1 parent
7026f62ff8
commit
d52d5003b1
4 files changed
+36
-29
No files matched your search
@@ -1,4 +1,4 @@
|
||||
use std::{env::consts::OS, path::PathBuf};
|
||||
use std::env::consts::OS;
|
||||
|
||||
use either::Either;
|
||||
use figment::Figment;
|
||||
@@ -264,14 +264,14 @@ pub fn check(config: &Config) -> Result {
|
||||
}
|
||||
|
||||
if config.smtp.as_ref().is_some_and(|f| {
|
||||
f.connection_uri.is_none() && f.connection_uri_file.is_none()
|
||||
|| (f.connection_uri == Some(String::new())
|
||||
&& f.connection_uri_file == Some(PathBuf::new()))
|
||||
f.connection_uri.as_ref().is_none_or(String::is_empty)
|
||||
&& f.connection_uri_file
|
||||
.as_ref()
|
||||
.is_none_or(|f| f.as_os_str().is_empty())
|
||||
}) {
|
||||
return Err!(Config(
|
||||
"connection_uri",
|
||||
"If smtp is enabled, either connection_uri or connection_uri_file has to be \
|
||||
defined."
|
||||
"If smtp is enabled, either connection_uri or connection_uri_file has to be defined."
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -2592,7 +2592,11 @@ pub struct SmtpConfig {
|
||||
pub connection_uri: Option<String>,
|
||||
|
||||
/// Same as `connection_uri`, except loaded from a file. If `connection_uri`
|
||||
/// is defined, it is prioritized and `connection_uri_file` is ignored
|
||||
/// is defined, it is prioritized and `connection_uri_file` is ignored.
|
||||
///
|
||||
/// The file will be read once, when Continuwuity starts. It is not
|
||||
/// currently reread when the server configuration is reloaded. If the file
|
||||
/// cannot be read, Continuwuity will fail to start.
|
||||
pub connection_uri_file: Option<PathBuf>,
|
||||
|
||||
/// The outgoing address which will be used for sending emails.
|
||||
|
||||
Reference in new issue
Block a user