MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / init_domain

Method init_domain

gateway/src/distributed_certbot.rs:63–83  ·  view source on GitHub ↗

Initialize certificate for a specific domain

(&self, domain: &str)

Source from the content-addressed store, hash-verified

61
62 /// Initialize certificate for a specific domain
63 pub async fn init_domain(&self, domain: &str) -> Result<()> {
64 // First, try to load from KvStore (synced from other nodes)
65 if let Some(cert_data) = self.kv_store.get_cert_data(domain) {
66 let now = now_secs();
67 if cert_data.not_after > now {
68 info!(
69 domain,
70 "loaded from KvStore (issued by node {}, expires in {} days)",
71 cert_data.issued_by,
72 (cert_data.not_after - now) / 86400
73 );
74 self.cert_resolver.update_cert(domain, &cert_data)?;
75 return Ok(());
76 }
77 info!(domain, "KvStore certificate expired, will request new one");
78 }
79
80 // No valid cert, need to request new one
81 info!(domain, "no valid certificate found, requesting from ACME");
82 self.request_new_cert(domain).await
83 }
84
85 /// Try to renew all ZT-Domain certificates
86 pub async fn try_renew_all(&self) -> Result<()> {

Callers 1

init_allMethod · 0.80

Calls 4

update_certMethod · 0.80
request_new_certMethod · 0.80
now_secsFunction · 0.70
get_cert_dataMethod · 0.45

Tested by

no test coverage detected