MCPcopy Create free account
hub / github.com/erans/pgsqlite / initialize

Method initialize

src/ssl/cert_manager.rs:31–55  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

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

Callers 3

mainFunction · 0.80

Calls 2

discover_certificatesMethod · 0.80
create_tls_acceptorMethod · 0.80

Tested by 2