Skip to content

Commit

Permalink
kwil-admin: make parent .kwil-admin director if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jchappelow authored and brennanjl committed Feb 26, 2024
1 parent 793a56c commit 164bc4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/kwil-admin/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func (ngkc *NodeGenAuthKeyCmd) run(ctx context.Context, a *args) error {
if fileExists(clientKeyFile) {
return fmt.Errorf("key file exists: %v", clientKeyFile)
}
if err := os.MkdirAll(filepath.Dir(clientKeyFile), 0755); err != nil {
return fmt.Errorf("failed to create key file dir: %v", err)
}

clientCertFile := a.Node.ClientTLSCertFile
if !filepath.IsAbs(clientCertFile) {
Expand All @@ -59,6 +62,9 @@ func (ngkc *NodeGenAuthKeyCmd) run(ctx context.Context, a *args) error {
if fileExists(clientCertFile) {
return fmt.Errorf("cert file exists: %v", clientCertFile)
}
if err := os.MkdirAll(filepath.Dir(clientCertFile), 0755); err != nil {
return fmt.Errorf("failed to create key file dir: %v", err)
}

return transport.GenTLSKeyPair(clientCertFile, clientKeyFile, "kwild CA", nil)
}
Expand Down

0 comments on commit 164bc4b

Please sign in to comment.