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