Skip to content

Commit 69941c0

Browse files
committed
cmd/go-cache-plugin: write out signing cert when it can't be installed
1 parent 32fc9bc commit 69941c0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/go-cache-plugin/addca_default.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@ package main
77

88
import (
99
"errors"
10+
"log"
1011

12+
"github.com/creachadair/atomicfile"
1113
"github.com/creachadair/command"
1214
"github.com/creachadair/tlsutil"
1315
)
1416

1517
func installSigningCert(env *command.Env, cert tlsutil.Certificate) error {
18+
const certFile = "revproxy-ca.crt"
19+
if err := atomicfile.WriteData(certFile, cert.CertPEM(), 0644); err != nil {
20+
log.Printf("WARNING: Unable to write cert file: %v", err)
21+
} else {
22+
log.Printf("Wrote signing cert to %s", certFile)
23+
}
1624
// TODO(creachadair): Maybe crib some other cases from mkcert, if we need
1725
// them, for example:
1826
// https://github.com/FiloSottile/mkcert/blob/master/truststore_darwin.go

0 commit comments

Comments
 (0)