Skip to main content

get_or_init_tls_materials

Function get_or_init_tls_materials 

Source
pub fn get_or_init_tls_materials(
    config: &TlsConfig,
) -> Result<Arc<TlsMaterials>>
Expand description

Get or initialize the shared TLS materials.

  • If already initialized, returns a clone of the Arc (no key bytes copied).
  • If both cert_path/key_path are set in config, loads from PEM files.
  • Otherwise, loads persisted materials from secrets.path (generating on first run). The key is stable across restarts; certs are renewed when approaching expiry.