()
| 24 | const defaultGroupList = "dgraph-unused-group" |
| 25 | |
| 26 | func init() { |
| 27 | CmdAcl.Cmd = &cobra.Command{ |
| 28 | Use: "acl", |
| 29 | Short: "Run the Dgraph ACL tool", |
| 30 | Annotations: map[string]string{"group": "security"}, |
| 31 | } |
| 32 | CmdAcl.Cmd.SetHelpTemplate(x.NonRootTemplate) |
| 33 | flag := CmdAcl.Cmd.PersistentFlags() |
| 34 | flag.StringP("alpha", "a", "127.0.0.1:9080", "Dgraph Alpha gRPC server address") |
| 35 | flag.String("guardian-creds", "", `Login credentials for the guardian |
| 36 | user defines the username to login. |
| 37 | password defines the password of the user. |
| 38 | namespace defines the namespace to log into. |
| 39 | Sample flag could look like --guardian-creds user=username;password=mypass;namespace=2`) |
| 40 | |
| 41 | // --tls SuperFlag |
| 42 | x.RegisterClientTLSFlags(flag) |
| 43 | |
| 44 | subcommands := initSubcommands() |
| 45 | for _, sc := range subcommands { |
| 46 | CmdAcl.Cmd.AddCommand(sc.Cmd) |
| 47 | sc.Conf = viper.New() |
| 48 | if err := sc.Conf.BindPFlags(sc.Cmd.Flags()); err != nil { |
| 49 | glog.Fatalf("Unable to bind flags for command %v: %v", sc, err) |
| 50 | } |
| 51 | if err := sc.Conf.BindPFlags(CmdAcl.Cmd.PersistentFlags()); err != nil { |
| 52 | glog.Fatalf("Unable to bind persistent flags from acl for command %v: %v", sc, err) |
| 53 | } |
| 54 | sc.Conf.SetEnvPrefix(sc.EnvPrefix) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func initSubcommands() []*x.SubCommand { |
| 59 | var cmdAdd x.SubCommand |
nothing calls this directly
no test coverage detected