1
0
Fork 0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-05-06 00:26:19 +02:00

certificate.Store: Call os.MkdirAll on Load

This commit is contained in:
Adnan Maolood 2021-03-09 08:59:23 -05:00
parent b00794f236
commit 93a606b591

View File

@ -6,6 +6,7 @@ import (
"crypto/x509/pkix"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"sync"
@ -160,6 +161,10 @@ func (s *Store) createCertificate(scope string) (tls.Certificate, error) {
// and private keys named "scope.crt" and "scope.key" respectively,
// where "scope" is the scope of the certificate.
func (s *Store) Load(path string) error {
if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
return err
}
path = filepath.Clean(path)
matches, err := filepath.Glob(filepath.Join(path, "*.crt"))
if err != nil {