2016-06-03 09:09:14 +08:00
|
|
|
package command
|
2012-08-24 11:56:09 +08:00
|
|
|
|
|
|
|
import (
|
2019-03-17 04:43:16 +08:00
|
|
|
"github.com/chrislusf/seaweedfs/weed/security"
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/shell"
|
2019-06-05 16:30:24 +08:00
|
|
|
"github.com/chrislusf/seaweedfs/weed/util"
|
2019-03-17 04:43:16 +08:00
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
2014-10-27 02:34:55 +08:00
|
|
|
|
2019-03-17 04:43:16 +08:00
|
|
|
var (
|
|
|
|
shellOptions shell.ShellOptions
|
2012-08-24 11:56:09 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2013-01-17 16:56:56 +08:00
|
|
|
cmdShell.Run = runShell // break init cycle
|
2019-03-17 04:43:16 +08:00
|
|
|
shellOptions.Masters = cmdShell.Flag.String("master", "localhost:9333", "comma-separated master servers")
|
2012-08-24 11:56:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
var cmdShell = &Command{
|
2013-01-17 16:56:56 +08:00
|
|
|
UsageLine: "shell",
|
2019-03-17 04:43:16 +08:00
|
|
|
Short: "run interactive administrative commands",
|
|
|
|
Long: `run interactive administrative commands.
|
2012-08-24 11:56:09 +08:00
|
|
|
|
|
|
|
`,
|
|
|
|
}
|
|
|
|
|
2013-01-17 16:56:56 +08:00
|
|
|
var ()
|
2012-08-24 11:56:09 +08:00
|
|
|
|
|
|
|
func runShell(command *Command, args []string) bool {
|
2019-03-17 04:43:16 +08:00
|
|
|
|
2019-06-05 16:30:24 +08:00
|
|
|
util.LoadConfiguration("security", false)
|
2019-03-17 04:43:16 +08:00
|
|
|
shellOptions.GrpcDialOption = security.LoadClientTLS(viper.Sub("grpc"), "client")
|
|
|
|
|
2019-04-03 15:20:00 +08:00
|
|
|
shellOptions.FilerHost = "localhost"
|
|
|
|
shellOptions.FilerPort = 8888
|
2019-04-05 10:27:51 +08:00
|
|
|
shellOptions.Directory = "/"
|
2019-04-03 15:20:00 +08:00
|
|
|
|
2019-03-17 04:43:16 +08:00
|
|
|
shell.RunShell(shellOptions)
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
2012-08-24 11:56:09 +08:00
|
|
|
}
|