Re-read certificates from the same paths used at construction and atomically swap the active config. Returns `Ok(())` when the new config was built and swapped successfully. Returns `Err(...)` if cert/key loading fails — the old config is preserved.
(&self)
| 82 | /// Returns `Ok(())` when the new config was built and swapped successfully. |
| 83 | /// Returns `Err(...)` if cert/key loading fails — the old config is preserved. |
| 84 | pub fn reload(&self) -> Result<()> { |
| 85 | let new_config = build_server_config( |
| 86 | &self.cert_path, |
| 87 | &self.key_path, |
| 88 | self.client_ca_path.as_deref(), |
| 89 | self.require_client_auth, |
| 90 | )?; |
| 91 | self.config.store(new_config); |
| 92 | |
| 93 | let event = ConfigStateChangeBuilder::new(&tls_ocsf_ctx()) |
| 94 | .severity(SeverityId::Informational) |
| 95 | .status(StatusId::Success) |
| 96 | .state(StateId::Enabled, "reloaded") |
| 97 | .message("TLS certificate config reloaded successfully") |
| 98 | .build(); |
| 99 | info!( |
| 100 | target: OCSF_TARGET, |
| 101 | sandbox_id = "", |
| 102 | message = %event.format_shorthand() |
| 103 | ); |
| 104 | |
| 105 | Ok(()) |
| 106 | } |
| 107 | |
| 108 | /// Return a fresh `tokio_rustls::TlsAcceptor` backed by the current config |
| 109 | /// snapshot. Each call clones the active `Arc<ServerConfig>` so it remains |