1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-10-17 20:05:55 +02:00

Refactor preauthkeys cmd

This commit is contained in:
ohdearaugustin 2021-07-25 15:07:27 +02:00
parent 2862c2034b
commit e56755fd67

View File

@ -10,12 +10,22 @@ import (
"github.com/spf13/cobra"
)
var PreauthkeysCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(preauthkeysCmd)
preauthkeysCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
preauthkeysCmd.AddCommand(listPreAuthKeys)
preauthkeysCmd.AddCommand(createPreAuthKeyCmd)
createPreAuthKeyCmd.PersistentFlags().Bool("reusable", false, "Make the preauthkey reusable")
createPreAuthKeyCmd.PersistentFlags().Bool("ephemeral", false, "Preauthkey for ephemeral nodes")
createPreAuthKeyCmd.Flags().StringP("expiration", "e", "", "Human-readable expiration of the key (30m, 24h, 365d...)")
}
var preauthkeysCmd = &cobra.Command{
Use: "preauthkeys",
Short: "Handle the preauthkeys in Headscale",
}
var ListPreAuthKeys = &cobra.Command{
var listPreAuthKeys = &cobra.Command{
Use: "list",
Short: "List the preauthkeys for this namespace",
Run: func(cmd *cobra.Command, args []string) {
@ -65,7 +75,7 @@ var ListPreAuthKeys = &cobra.Command{
},
}
var CreatePreAuthKeyCmd = &cobra.Command{
var createPreAuthKeyCmd = &cobra.Command{
Use: "create",
Short: "Creates a new preauthkey in the specified namespace",
Run: func(cmd *cobra.Command, args []string) {