Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Nov 25, 2023
1 parent c1d92a9 commit 701e57b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/app_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ fn env_config() -> config::Environment {
.with_list_parse_key("sqlite_extensions")
}

#[must_use]
pub fn default_listen_on() -> SocketAddr {
SocketAddr::from(([0, 0, 0, 0], 8080))
}
Expand Down
4 changes: 2 additions & 2 deletions src/webserver/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,12 @@ pub async fn run_server(config: &AppConfig, state: AppState) -> anyhow::Result<(
listen_on.set_port(443);
log::info!("Will start HTTPS server on {listen_on}");
server = server
.bind_rustls_021(listen_on, make_auto_rustls_config(domain, config)?)
.bind_rustls_021(listen_on, make_auto_rustls_config(domain, config))
.with_context(|| "Unable to listen to the specified port")?;
} else if listen_on.port() != 443 {
server = server
.bind(listen_on)
.with_context(|| "Unable to listen to the specified port")?
.with_context(|| "Unable to listen to the specified port")?;
} else {
bail!("Please specify a value for https_domain in the configuration file. This is required when using HTTPS.");
}
Expand Down
6 changes: 3 additions & 3 deletions src/webserver/https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use tokio_stream::StreamExt;

use crate::app_config::AppConfig;

pub fn make_auto_rustls_config(domain: &str, config: &AppConfig) -> anyhow::Result<ServerConfig> {
pub fn make_auto_rustls_config(domain: &str, config: &AppConfig) -> ServerConfig {
log::info!("Starting HTTPS configuration for {domain}");
let mut state = AcmeConfig::new([domain])
.contact([if let Some(email) = &config.https_certificate_email {
format!("mailto:{}", email.as_str())
} else {
format!("mailto:contact@{}", domain)
format!("mailto:contact@{domain}")
}])
.cache_option(Some(DirCache::new(
config.https_certificate_cache_dir.clone(),
Expand All @@ -27,5 +27,5 @@ pub fn make_auto_rustls_config(domain: &str, config: &AppConfig) -> anyhow::Resu
}
});

Ok(ServerConfig::clone(&rustls_config))
ServerConfig::clone(&rustls_config)
}

0 comments on commit 701e57b

Please sign in to comment.