|
@ -19,7 +19,7 @@ func init() { |
|
|
cmdShell.Run = runShell // break init cycle
|
|
|
cmdShell.Run = runShell // break init cycle
|
|
|
shellOptions.Masters = cmdShell.Flag.String("master", "", "comma-separated master servers, e.g. localhost:9333") |
|
|
shellOptions.Masters = cmdShell.Flag.String("master", "", "comma-separated master servers, e.g. localhost:9333") |
|
|
shellOptions.FilerGroup = cmdShell.Flag.String("filerGroup", "", "filerGroup for the filers") |
|
|
shellOptions.FilerGroup = cmdShell.Flag.String("filerGroup", "", "filerGroup for the filers") |
|
|
shellInitialFiler = cmdShell.Flag.String("filer", "", "filer host and port, e.g. localhost:8888") |
|
|
|
|
|
|
|
|
shellInitialFiler = cmdShell.Flag.String("filer", "", "filer host and port for initial connection, e.g. localhost:8888") |
|
|
shellCluster = cmdShell.Flag.String("cluster", "", "cluster defined in shell.toml") |
|
|
shellCluster = cmdShell.Flag.String("cluster", "", "cluster defined in shell.toml") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -30,32 +30,36 @@ var cmdShell = &Command{ |
|
|
|
|
|
|
|
|
Generate shell.toml via "weed scaffold -config=shell" |
|
|
Generate shell.toml via "weed scaffold -config=shell" |
|
|
|
|
|
|
|
|
`, |
|
|
|
|
|
|
|
|
`, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func runShell(command *Command, args []string) bool { |
|
|
func runShell(command *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
util.LoadConfiguration("security", false) |
|
|
shellOptions.GrpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
shellOptions.GrpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
shellOptions.Directory = "/" |
|
|
|
|
|
|
|
|
|
|
|
util.LoadConfiguration("shell", false) |
|
|
|
|
|
viper := util.GetViper() |
|
|
|
|
|
cluster := viper.GetString("cluster.default") |
|
|
|
|
|
if *shellCluster != "" { |
|
|
|
|
|
cluster = *shellCluster |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if *shellOptions.Masters == "" { |
|
|
if *shellOptions.Masters == "" { |
|
|
util.LoadConfiguration("shell", false) |
|
|
|
|
|
v := util.GetViper() |
|
|
|
|
|
cluster := v.GetString("cluster.default") |
|
|
|
|
|
if *shellCluster != "" { |
|
|
|
|
|
cluster = *shellCluster |
|
|
|
|
|
} |
|
|
|
|
|
if cluster == "" { |
|
|
if cluster == "" { |
|
|
*shellOptions.Masters = "localhost:9333" |
|
|
*shellOptions.Masters = "localhost:9333" |
|
|
} else { |
|
|
} else { |
|
|
*shellOptions.Masters = v.GetString("cluster." + cluster + ".master") |
|
|
|
|
|
*shellInitialFiler = v.GetString("cluster." + cluster + ".filer") |
|
|
|
|
|
fmt.Printf("master: %s filer: %s\n", *shellOptions.Masters, *shellInitialFiler) |
|
|
|
|
|
|
|
|
*shellOptions.Masters = viper.GetString("cluster." + cluster + ".master") |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
shellOptions.FilerAddress = pb.ServerAddress(*shellInitialFiler) |
|
|
|
|
|
shellOptions.Directory = "/" |
|
|
|
|
|
|
|
|
filerAddress := *shellInitialFiler |
|
|
|
|
|
if filerAddress == "" && cluster != "" { |
|
|
|
|
|
filerAddress = viper.GetString("cluster." + cluster + ".filer") |
|
|
|
|
|
} |
|
|
|
|
|
shellOptions.FilerAddress = pb.ServerAddress(filerAddress) |
|
|
|
|
|
fmt.Printf("master: %s filer: %s\n", *shellOptions.Masters, shellOptions.FilerAddress) |
|
|
|
|
|
|
|
|
shell.RunShell(shellOptions) |
|
|
shell.RunShell(shellOptions) |
|
|
|
|
|
|
|
|