Moved global flag variables to the global scope. Refactored some functions interfaces and removed passing global flags.
This commit is contained in:
21
main.go
21
main.go
@@ -9,22 +9,31 @@ import (
|
||||
|
||||
var Version = "dev"
|
||||
|
||||
// Global flags available to all commands
|
||||
var overwrite bool
|
||||
var dryRun bool
|
||||
var verbose bool
|
||||
|
||||
func main() {
|
||||
|
||||
var overwrite bool
|
||||
// issue command flags
|
||||
var name string
|
||||
var subject string
|
||||
var certType string
|
||||
var validity string
|
||||
var san []string
|
||||
var name string
|
||||
var dryRun bool
|
||||
var verbose bool
|
||||
|
||||
// provision command flags
|
||||
var provisionFile string
|
||||
|
||||
// crl command flags
|
||||
var crlFile string
|
||||
var crlValidityDays int
|
||||
|
||||
// revoke command flags
|
||||
var revokeName string
|
||||
var revokeSerial string
|
||||
var revokeReasonStr string
|
||||
var provisionFile string
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "lab-ca",
|
||||
@@ -46,7 +55,7 @@ func main() {
|
||||
Use: "initca",
|
||||
Short: "Generate a new CA certificate and key",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
InitCA(overwrite)
|
||||
InitCA()
|
||||
},
|
||||
}
|
||||
rootCmd.AddCommand(initCmd)
|
||||
|
Reference in New Issue
Block a user