Files
shhh/internal/clis/hmsecrets/rootcmd.go
T

60 lines
1.0 KiB
Go

package hmsecrets
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var apiBase string
var caFile string
var clientCert string
var clientKey string
func init() {
rootCmd.PersistentFlags().StringVar(
&apiBase,
"api-base",
"",
"base url for the service",
)
rootCmd.MarkPersistentFlagRequired("api-base")
rootCmd.PersistentFlags().StringVar(
&caFile,
"ca-file",
"",
"CA cert file",
)
rootCmd.MarkPersistentFlagRequired("ca-file")
rootCmd.PersistentFlags().StringVar(
&clientCert,
"client-cert",
"",
"certificate to be used for client mTLS auth",
)
rootCmd.MarkPersistentFlagRequired("client-cert")
rootCmd.PersistentFlags().StringVar(
&clientKey,
"client-key",
"",
"private key for the certificate to be used for client mTLS auth",
)
rootCmd.MarkPersistentFlagRequired("client-key")
}
var rootCmd = &cobra.Command{
Use: "hmsecrets",
Short: "Interact with the HandMade secrets service",
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}