From a5477d77b39bc3cee9ffa96117fb7b7a2598f5db Mon Sep 17 00:00:00 2001
From: godog <godog@autistici.org>
Date: Tue, 4 Jun 2019 22:40:41 +0200
Subject: [PATCH] Switch to certbot pem names

Easier to swap between the two.
---
 manager_test.go | 2 +-
 storage.go      | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/manager_test.go b/manager_test.go
index 895164e7..4ee0ce2a 100644
--- a/manager_test.go
+++ b/manager_test.go
@@ -125,7 +125,7 @@ func TestManager_NewCert(t *testing.T) {
 	if _, err := os.Stat(p); err != nil {
 		t.Fatalf("file not created: %v", err)
 	}
-	p = filepath.Join(m.configDirs[0], "../certs/example.com/private_key.pem")
+	p = filepath.Join(m.configDirs[0], "../certs/example.com/privkey.pem")
 	if _, err := os.Stat(p); err != nil {
 		t.Fatalf("file not created: %v", err)
 	}
diff --git a/storage.go b/storage.go
index 64a938e2..cffdf405 100644
--- a/storage.go
+++ b/storage.go
@@ -25,7 +25,7 @@ type dirStorage struct {
 
 func (d *dirStorage) GetCert(cn string) ([][]byte, crypto.Signer, error) {
 	certPath := filepath.Join(d.root, cn, "fullchain.pem")
-	keyPath := filepath.Join(d.root, cn, "private_key.pem")
+	keyPath := filepath.Join(d.root, cn, "privkey.pem")
 
 	der, err := parseCertsFromFile(certPath)
 	if err != nil {
@@ -53,7 +53,7 @@ func (d *dirStorage) PutCert(cn string, der [][]byte, key crypto.Signer) error {
 
 	for path, data := range filemap {
 		var mode os.FileMode = 0644
-		if strings.HasSuffix(path, "private_key.pem") {
+		if strings.HasSuffix(path, "privkey.pem") {
 			mode = 0400
 		}
 		log.Printf("writing %s (%03o)", path, mode)
@@ -83,7 +83,7 @@ func dumpCertsAndKey(cn string, der [][]byte, key crypto.Signer) (map[string][]b
 	if err != nil {
 		return nil, err
 	}
-	m[filepath.Join(cn, "private_key.pem")] = data
+	m[filepath.Join(cn, "privkey.pem")] = data
 
 	return m, nil
 }
-- 
GitLab