forked from supabase/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
encryption.go
41 lines (35 loc) · 1.09 KB
/
encryption.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package cmd
import (
"os"
"github.com/spf13/cobra"
"github.com/supabase/cli/internal/encryption/get"
"github.com/supabase/cli/internal/encryption/update"
"github.com/supabase/cli/internal/utils/flags"
)
var (
encryptionCmd = &cobra.Command{
GroupID: groupManagementAPI,
Use: "encryption",
Short: "Manage encryption keys of Supabase projects",
}
rootKeyGetCmd = &cobra.Command{
Use: "get-root-key",
Short: "Get the root encryption key of a Supabase project",
RunE: func(cmd *cobra.Command, args []string) error {
return get.Run(cmd.Context(), flags.ProjectRef)
},
}
rootKeyUpdateCmd = &cobra.Command{
Use: "update-root-key",
Short: "Update root encryption key of a Supabase project",
RunE: func(cmd *cobra.Command, args []string) error {
return update.Run(cmd.Context(), flags.ProjectRef, os.Stdin)
},
}
)
func init() {
encryptionCmd.PersistentFlags().StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.")
encryptionCmd.AddCommand(rootKeyUpdateCmd)
encryptionCmd.AddCommand(rootKeyGetCmd)
rootCmd.AddCommand(encryptionCmd)
}