-
Notifications
You must be signed in to change notification settings - Fork 232
/
Copy pathrestrictions.go
44 lines (38 loc) · 1.39 KB
/
restrictions.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
42
43
44
package cmd
import (
"github.com/spf13/cobra"
"github.com/supabase/cli/internal/restrictions/get"
"github.com/supabase/cli/internal/restrictions/update"
"github.com/supabase/cli/internal/utils/flags"
)
var (
restrictionsCmd = &cobra.Command{
GroupID: groupManagementAPI,
Use: "network-restrictions",
Short: "Manage network restrictions",
}
dbCidrsToAllow []string
bypassCidrChecks bool
restrictionsUpdateCmd = &cobra.Command{
Use: "update",
Short: "Update network restrictions",
RunE: func(cmd *cobra.Command, args []string) error {
return update.Run(cmd.Context(), flags.ProjectRef, dbCidrsToAllow, bypassCidrChecks)
},
}
restrictionsGetCmd = &cobra.Command{
Use: "get",
Short: "Get the current network restrictions",
RunE: func(cmd *cobra.Command, args []string) error {
return get.Run(cmd.Context(), flags.ProjectRef)
},
}
)
func init() {
restrictionsCmd.PersistentFlags().StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.")
restrictionsUpdateCmd.Flags().StringSliceVar(&dbCidrsToAllow, "db-allow-cidr", []string{}, "CIDR to allow DB connections from.")
restrictionsUpdateCmd.Flags().BoolVar(&bypassCidrChecks, "bypass-cidr-checks", false, "Bypass some of the CIDR validation checks.")
restrictionsCmd.AddCommand(restrictionsGetCmd)
restrictionsCmd.AddCommand(restrictionsUpdateCmd)
rootCmd.AddCommand(restrictionsCmd)
}