Skip to content

Commit

Permalink
Merge pull request #1071 from fabriziosestito/fix/do-not-panic-in-cer…
Browse files Browse the repository at this point in the history
…t-hot-reload-task

fix: do not panic in certificate hot-reload task
  • Loading branch information
flavio authored Feb 5, 2025
2 parents 7893c0e + 869ed4b commit abdd8b6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ async fn create_tls_config_and_watch_certificate_changes(
async fn create_tls_config_and_watch_certificate_changes(
tls_config: TlsConfig,
) -> Result<RustlsConfig> {
use ::tracing::error;

let cert_file = tls_config.cert_file.clone();
let key_file = tls_config.key_file.clone();

Expand Down Expand Up @@ -342,10 +344,12 @@ async fn create_tls_config_and_watch_certificate_changes(

cert_changed = false;
key_changed = false;
reloadable_rust_config
if let Err(e) = reloadable_rust_config
.reload_from_pem_file(cert_file.clone(), key_file.clone())
.await
.expect("Cannot reload TLS certificate"); // we want to panic here
{
error!("Failed to reload TLS certificate: {}", e);
}
}
}
});
Expand Down

0 comments on commit abdd8b6

Please sign in to comment.