From 8e3481a8ef7bcc38b459aa9dcce6d00458871f1e Mon Sep 17 00:00:00 2001 From: max furman Date: Wed, 12 Aug 2020 16:35:38 -0700 Subject: [PATCH] [logger map] small optimization Rather than doing two key writes and one lookup, just write once. --- api/api.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/api.go b/api/api.go index 23856e09..6e0b08eb 100644 --- a/api/api.go +++ b/api/api.go @@ -414,9 +414,10 @@ func LogCertificate(w http.ResponseWriter, cert *x509.Certificate) { if err != nil || len(rest) > 0 { break } - m["provisioner"] = fmt.Sprintf("%s", val.Name) if len(val.CredentialID) > 0 { - m["provisioner"] = fmt.Sprintf("%s (%s)", m["provisioner"], val.CredentialID) + m["provisioner"] = fmt.Sprintf("%s (%s)", val.Name, val.CredentialID) + } else { + m["provisioner"] = fmt.Sprintf("%s", val.Name) } break }