refactor: generate ca now generates and writes its own private key.

This commit is contained in:
jmug committed 2026-10-22 16:30:01 -07:00
1 parent 16474e57b9
commit 657208a7c2
2 files changed
+30 -48

No files matched your search

+19 -13
View File
@@ -5,28 +5,34 @@ import (
)
// Needed by all subcommands.
var Output string
// Needed by some subcommands.
var KeyFile string
var Name string
var OutDir string
func init() {
rootCmd.AddCommand(generateCmd)
// All "generate" commands output an artifact to a file,
// be it a key or a cert, etc.
// Name for artifacts being written to file(s).
generateCmd.PersistentFlags().StringVarP(
&Output,
"output",
"o",
&Name,
"name",
"n",
"",
"output filename",
"name of the artifact being benerated",
)
generateCmd.MarkPersistentFlagRequired("output")
generateCmd.MarkPersistentFlagFilename("output")
generateCmd.MarkPersistentFlagRequired("name")
// Output direcotry.
generateCmd.PersistentFlags().StringVar(
&OutDir,
"output-dir",
".",
"output directory for artifacts produced by this command, defaults to the current directory",
)
generateCmd.MarkPersistentFlagRequired("output-dir")
generateCmd.MarkPersistentFlagDirname("output-dir")
}
var generateCmd = &cobra.Command{
Use: "generate",
Short: "Generate pki resources (keys/certs)",
Short: "Generate pki resources (cas/keys/certs)",
}