aboutsummaryrefslogtreecommitdiff
path: root/weed/command/shell.go
blob: eae68c3bee01048a9adf4453b79a80bf753c4256 (plain)
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
package command

import (
	"github.com/chrislusf/seaweedfs/weed/security"
	"github.com/chrislusf/seaweedfs/weed/shell"
	"github.com/chrislusf/seaweedfs/weed/util"
	"github.com/spf13/viper"
)

var (
	shellOptions shell.ShellOptions
)

func init() {
	cmdShell.Run = runShell // break init cycle
	shellOptions.Masters = cmdShell.Flag.String("master", "localhost:9333", "comma-separated master servers")
	filerHost := cmdShell.Flag.String("filer.host", "localhost", "comma-separated filer server host")
	flierPort := cmdShell.Flag.Int64("filer.port", 8888, "comma-separated filer server port")
	directory := cmdShell.Flag.String("filer.dir", "/", "comma-separated filer server directory")
	shellOptions.FilerHost = *filerHost
	shellOptions.FilerPort = *flierPort
	shellOptions.Directory = *directory
}

var cmdShell = &Command{
	UsageLine: "shell",
	Short:     "run interactive administrative commands",
	Long: `run interactive administrative commands.

  `,
}


func runShell(command *Command, args []string) bool {

	util.LoadConfiguration("security", false)
	shellOptions.GrpcDialOption = security.LoadClientTLS(viper.Sub("grpc"), "client")

	shell.RunShell(shellOptions)

	return true

}