Skip to content

Commit 179a3dd

Browse files
committed
fixup! Log successfully issued certificates.
1 parent 12456e3 commit 179a3dd

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

src/lib.rs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ async fn ngx_http_acme_update_certificates_for_issuer(
280280
continue;
281281
};
282282

283+
let order_id = order.cache_key();
284+
283285
{
284286
let locked = cert.read();
285287

@@ -290,9 +292,8 @@ async fn ngx_http_acme_update_certificates_for_issuer(
290292
if !locked.is_renewable() {
291293
ngx_log_debug!(
292294
log.as_ptr(),
293-
"acme: certificate \"{}/{}\" is not due for renewal",
294-
issuer.name,
295-
order.cache_key()
295+
"acme: certificate \"{issuer}/{order_id}\" is not due for renewal",
296+
issuer = issuer.name,
296297
);
297298
next = cmp::min(locked.next, next);
298299
continue;
@@ -324,9 +325,9 @@ async fn ngx_http_acme_update_certificates_for_issuer(
324325
ngx_log_error!(
325326
NGX_LOG_INFO,
326327
log.as_ptr(),
327-
"acme certificate \"{}/{}\" issued, next renewal in {:?}",
328+
"acme certificate \"{}/{}\" issued, next update in {:?}",
328329
issuer.name,
329-
order.cache_key(),
330+
order_id,
330331
(x - now)
331332
);
332333
x
@@ -335,23 +336,19 @@ async fn ngx_http_acme_update_certificates_for_issuer(
335336
ngx_log_error!(
336337
NGX_LOG_WARN,
337338
log.as_ptr(),
338-
"acme certificate \"{}/{}\" request failed: {}",
339-
issuer.name,
340-
order.cache_key(),
341-
err
339+
"{err} while updating certificate \"{issuer}/{order_id}\"",
340+
issuer = issuer.name,
342341
);
343342
now + ACME_MIN_INTERVAL
344343
}
345344
};
346345

347346
// Write files even if we failed to update the shared zone.
348347

349-
let _ =
350-
issuer.write_state_file(std::format!("{}.crt", order.cache_key()), &val.chain);
348+
let _ = issuer.write_state_file(std::format!("{order_id}.crt"), &val.chain);
351349

352350
if !matches!(order.key, conf::pkey::PrivateKey::File(_)) {
353-
let _ =
354-
issuer.write_state_file(std::format!("{}.key", order.cache_key()), &pkey);
351+
let _ = issuer.write_state_file(std::format!("{order_id}.key"), &pkey);
355352
}
356353

357354
next
@@ -360,25 +357,22 @@ async fn ngx_http_acme_update_certificates_for_issuer(
360357
ngx_log_error!(
361358
NGX_LOG_ERR,
362359
log.as_ptr(),
363-
"acme certificate \"{}/{}\" request is not valid: {}",
364-
issuer.name,
365-
order.cache_key(),
366-
err
360+
"{err} while updating certificate \"{issuer}/{order_id}\"",
361+
issuer = issuer.name,
367362
);
368363
cert.write().set_invalid(&err);
369364

370365
// We marked the order as invalid and will stop attempting to update it until the
371366
// next configuration reload. It should not affect the next update schedule.
367+
372368
continue;
373369
}
374370
Err(ref err) => {
375371
ngx_log_error!(
376372
NGX_LOG_WARN,
377373
log.as_ptr(),
378-
"acme certificate \"{}/{}\" request failed: {}",
379-
issuer.name,
380-
order.cache_key(),
381-
err
374+
"{err} while updating certificate \"{issuer}/{order_id}\"",
375+
issuer = issuer.name,
382376
);
383377
cert.write().set_error(&err)
384378
}

0 commit comments

Comments
 (0)