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

Method renew_cert_if_needed

certbot/src/acme_client.rs:194–208  ·  view source on GitHub ↗

Auto renew given certificate Checks if the certificate is about to expire and renews it if necessary.

(
        &self,
        cert_pem: &str,
        key_pem: &str,
        expires_in: Duration,
    )

Source from the content-addressed store, hash-verified

192 ///
193 /// Checks if the certificate is about to expire and renews it if necessary.
194 pub async fn renew_cert_if_needed(
195 &self,
196 cert_pem: &str,
197 key_pem: &str,
198 expires_in: Duration,
199 ) -> Result<Option<String>> {
200 if !need_renew(cert_pem, expires_in)? {
201 return Ok(None);
202 }
203 let cert = self
204 .renew_cert(cert_pem, key_pem)
205 .await
206 .context("failed to renew cert")?;
207 Ok(Some(cert))
208 }
209
210 /// Renew given certificate
211 pub async fn renew_cert(&self, cert_pem: &str, key_pem: &str) -> Result<String> {

Callers 1

auto_renewMethod · 0.80

Calls 2

need_renewFunction · 0.85
renew_certMethod · 0.45

Tested by

no test coverage detected