You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

13 years ago
13 years ago
13 years ago
13 years ago
  1. package command
  2. import (
  3. "github.com/chrislusf/seaweedfs/weed/security"
  4. "github.com/chrislusf/seaweedfs/weed/shell"
  5. "github.com/chrislusf/seaweedfs/weed/util"
  6. "github.com/spf13/viper"
  7. )
  8. var (
  9. shellOptions shell.ShellOptions
  10. )
  11. func init() {
  12. cmdShell.Run = runShell // break init cycle
  13. shellOptions.Masters = cmdShell.Flag.String("master", "localhost:9333", "comma-separated master servers")
  14. filerHost := cmdShell.Flag.String("filer.host", "localhost", "comma-separated filer server host")
  15. flierPort := cmdShell.Flag.Int64("filer.port", 9333, "comma-separated filer server port")
  16. directory := cmdShell.Flag.String("filer.dir", "/", "comma-separated filer server directory")
  17. shellOptions.FilerHost = *filerHost
  18. shellOptions.FilerPort = *flierPort
  19. shellOptions.Directory = *directory
  20. }
  21. var cmdShell = &Command{
  22. UsageLine: "shell",
  23. Short: "run interactive administrative commands",
  24. Long: `run interactive administrative commands.
  25. `,
  26. }
  27. func runShell(command *Command, args []string) bool {
  28. util.LoadConfiguration("security", false)
  29. shellOptions.GrpcDialOption = security.LoadClientTLS(viper.Sub("grpc"), "client")
  30. shell.RunShell(shellOptions)
  31. return true
  32. }