shell: optionally read filer address from master

This commit is contained in:
Chris Lu
2021-11-02 23:38:45 -07:00
parent 18bfbf62fc
commit 5160eb08f7
10 changed files with 689 additions and 484 deletions

View File

@@ -37,7 +37,7 @@ func runShell(command *Command, args []string) bool {
util.LoadConfiguration("security", false)
shellOptions.GrpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client")
if *shellOptions.Masters == "" && *shellInitialFiler == "" {
if *shellOptions.Masters == "" {
util.LoadConfiguration("shell", false)
v := util.GetViper()
cluster := v.GetString("cluster.default")
@@ -45,15 +45,16 @@ func runShell(command *Command, args []string) bool {
cluster = *shellCluster
}
if cluster == "" {
*shellOptions.Masters, *shellInitialFiler = "localhost:9333", "localhost:8888"
*shellOptions.Masters = "localhost:9333"
fmt.Printf("master: %s\n", *shellOptions.Masters)
} else {
*shellOptions.Masters = v.GetString("cluster." + cluster + ".master")
*shellInitialFiler = v.GetString("cluster." + cluster + ".filer")
fmt.Printf("master: %s filer: %s\n", *shellOptions.Masters, *shellInitialFiler)
}
}
fmt.Printf("master: %s filer: %s\n", *shellOptions.Masters, *shellInitialFiler)
shellOptions.FilerAddress = pb.ServerAddress(*shellInitialFiler)
shellOptions.Directory = "/"