| 29 | } |
| 30 | |
| 31 | pub async fn initialize(&self) -> Result<(TlsAcceptor, CertificateSource)> { |
| 32 | let cert_source = self.discover_certificates().await?; |
| 33 | |
| 34 | // Log the certificate source |
| 35 | match &cert_source { |
| 36 | CertificateSource::Provided { cert_path, key_path } => { |
| 37 | info!("SSL enabled with provided certificates from {} and {}", cert_path, key_path); |
| 38 | } |
| 39 | CertificateSource::FileSystem { cert_path, key_path } => { |
| 40 | info!("SSL enabled with existing certificates from {} and {}", cert_path, key_path); |
| 41 | } |
| 42 | CertificateSource::Generated { .. } => { |
| 43 | if self.config.database == ":memory:" || self.config.in_memory { |
| 44 | info!("SSL enabled with ephemeral in-memory certificates"); |
| 45 | } else if self.config.ssl_ephemeral { |
| 46 | info!("SSL enabled with ephemeral certificates (not persisted)"); |
| 47 | } else { |
| 48 | info!("SSL enabled with newly generated certificates"); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | let tls_acceptor = self.create_tls_acceptor(&cert_source).await?; |
| 54 | Ok((tls_acceptor, cert_source)) |
| 55 | } |
| 56 | |
| 57 | async fn discover_certificates(&self) -> Result<CertificateSource> { |
| 58 | // Priority 1: Check provided paths from config |