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 5471d65 commit 26df615
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions cli/cmd/aeon.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path/filepath"
"regexp"

"github.com/spf13/cobra"
aeon "github.com/tarantool/tt/cli/aeon"
Expand Down Expand Up @@ -91,7 +92,12 @@ func NewAeonCmd() *cobra.Command {

func aeonConnectValidateArgs(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
fmt.Println("(args[0]", (args[0]))

connectCtx.Network, connectCtx.Address = libconnect.ParseBaseURI(args[0])

fmt.Println("connectCtx.Network", connectCtx.Network)
fmt.Println("connectCtx.Address", connectCtx.Address)
} else if cmd.Flags().Changed("config") && cmd.Flags().Changed("instanceName") {
f, err := os.ReadFile(configPath)
if err != nil {
Expand Down Expand Up @@ -119,13 +125,23 @@ func aeonConnectValidateArgs(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}


fmt.Println("URI", uri)

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

connectCtx.Network, connectCtx.Address = libconnect.ParseBaseURI(us)
re := regexp.MustCompile("^https?://")
cleanedURL := re.ReplaceAllString(us, "")

fmt.Println("US", us)

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

fmt.Println("connectCtx.Network", connectCtx.Network)
fmt.Println("connectCtx.Address", connectCtx.Address)
}

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

0 comments on commit 26df615

Please sign in to comment.