src/server/auth/cmds/configure.go
func GetConfigCmd(noPortForwarding *bool) *cobra.Command {
	var format string
	getConfig := &cobra.Command{
		Short: "Retrieve Pachyderm's current auth configuration",
		Long:  "Retrieve Pachyderm's current auth configuration",
		Run: cmdutil.RunFixedArgs(0, func(args []string) error {
			c, err := client.NewOnUserMachine(true, !*noPortForwarding, "user")
			if err != nil {
				return fmt.Errorf("could not connect: %v", err)
			}
			defer c.Close()
			resp, err := c.GetConfiguration(c.Ctx(), &auth.GetConfigurationRequest{})
			if err != nil {
				return grpcutil.ScrubGRPC(err)
			}
			if resp.Configuration == nil {
				fmt.Println("no auth config set")
				return nil
			}
			output, err := json.MarshalIndent(resp.Configuration, "", "  ")
			if err != nil {
				return fmt.Errorf("could not marshal response:\n%v\ndue to: %v", resp.Configuration, err)
			}
			switch format {
			case "json":
				// already done
			case "yaml":
				output, err = yaml.JSONToYAML(output)
				if err != nil {
					return fmt.Errorf("could not convert json to yaml: %v", err)
				}
			default:
				return fmt.Errorf("invalid output format: %v", format)
			}
			fmt.Println(string(output))
			return nil
		}),
	}
	getConfig.Flags().StringVarP(&format, "output-format", "o", "json", "output "+
		"format (\"json\" or \"yaml\")")
	return cmdutil.CreateAlias(getConfig, "auth get-config")
}
func GetConfigCmd(noPortForwarding *bool) *cobra.Command {
	var format string
	getConfig := &cobra.Command{
		Short: "Retrieve Pachyderm's current auth configuration",
		Long:  "Retrieve Pachyderm's current auth configuration",
		Run: cmdutil.RunFixedArgs(0, func(args []string) error {
			c, err := client.NewOnUserMachine(true, !*noPortForwarding, "user")
			if err != nil {
				return fmt.Errorf("could not connect: %v", err)
			}
			defer c.Close()
			resp, err := c.GetConfiguration(c.Ctx(), &auth.GetConfigurationRequest{})
			if err != nil {
				return grpcutil.ScrubGRPC(err)
			}
			if resp.Configuration == nil {
				fmt.Println("no auth config set")
				return nil
			}
			output, err := json.MarshalIndent(resp.Configuration, "", "  ")
			if err != nil {
				return fmt.Errorf("could not marshal response:\n%v\ndue to: %v", resp.Configuration, err)
			}
			switch format {
			case "json":
				// already done
			case "yaml":
				output, err = yaml.JSONToYAML(output)
				if err != nil {
					return fmt.Errorf("could not convert json to yaml: %v", err)
				}
			default:
				return fmt.Errorf("invalid output format: %v", format)
			}
			fmt.Println(string(output))
			return nil
		}),
	}
	getConfig.Flags().StringVarP(&format, "output-format", "o", "json", "output "+
		"format (\"json\" or \"yaml\")")
	return cmdutil.CreateAlias(getConfig, "auth get-config")
}
// GetConfigCmd returns a cobra command that lets the caller see the configured
// auth backends in Pachyderm