MCPcopy
hub / github.com/dgraph-io/dgraph / init

Function init

acl/run.go:26–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24const defaultGroupList = "dgraph-unused-group"
25
26func 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
58func initSubcommands() []*x.SubCommand {
59 var cmdAdd x.SubCommand

Callers

nothing calls this directly

Calls 4

RegisterClientTLSFlagsFunction · 0.92
FatalfMethod · 0.80
initSubcommandsFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected