Skip to content

Commit

Permalink
aeon:added the ability to connect from the config Closes #TNTP-1073
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrLitkevich committed Jan 31, 2025
1 parent 2a018f4 commit 5471d65
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions cli/cmd/aeon.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,54 +114,19 @@ func aeonConnectValidateArgs(cmd *cobra.Command, args []string) error {

result := cluster.Instantiate(clusterConfig, instance)

path := []string{"iproto", "listen"}
lconfig, err := result.Get(path)
path := []string{"roles_cfg", "aeon.grpc", "advertise", "uri"}
uri, err := result.Get(path)
if err != nil {
return err
}

d, ok := lconfig.([]any)
if !ok {
return fmt.Errorf("fail convert slice uri")
}

fmt.Println("THIS d", d)
fmt.Println("THIS d[0]", d[0])

if len(d) == 0 {
return fmt.Errorf("the connection URI could not be found in the specified configuration file")
}

fmt.Println("d[0]", d[0])

c, ok := d[0].(map[any]any)
if !ok {
return fmt.Errorf("fail convert map")
}

uri, ok := c["uri"]
if !ok {
return fmt.Errorf("fail to get uri ")
}


us, ok := uri.(string)
if !ok {
return fmt.Errorf("fail to conver string")
}

connectCtx.Network, connectCtx.Address = libconnect.ParseBaseURI(us)

fmt.Println("URI", lconfig)

//парсим кофиг
}

path, err := cmd.Flags().GetString("config")
if err != nil {
return err
}
fmt.Println("PATH CONFIG", path)
fmt.Println("VAR configPath", configPath)

if !cmd.Flags().Changed("transport") && (connectCtx.Ssl.KeyFile != "" ||
connectCtx.Ssl.CertFile != "" || connectCtx.Ssl.CaFile != "") {
Expand Down

0 comments on commit 5471d65

Please sign in to comment.