MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / reload

Method reload

crates/openshell-server/src/tls.rs:84–106  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Calls 5

build_server_configFunction · 0.85
tls_ocsf_ctxFunction · 0.85
messageMethod · 0.80
stateMethod · 0.80
buildMethod · 0.45

Tested by 4

test_reload_successFunction · 0.36