Skip to content

Commit

Permalink
fix using chain name from a function to replace delimeter to undersco…
Browse files Browse the repository at this point in the history
…re (#234)
  • Loading branch information
Anmol1696 authored Sep 13, 2023
1 parent 78bd5e2 commit b8b22ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/starship/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func (c *Client) PortForwardCmds() ([]*exec.Cmd, []string, error) {
if port == 0 {
continue
}
msgs = append(msgs, fmt.Sprintf("port-forwarding: %s: port %s: to: http://localhost:%d", chain.Name, portType, port))
cmds = append(cmds, c.execPortForwardCmd(fmt.Sprintf("pods/%s-genesis-0", chain.Name), port, remotePort))
msgs = append(msgs, fmt.Sprintf("port-forwarding: %s: port %s: to: http://localhost:%d", chain.GetName(), portType, port))
cmds = append(cmds, c.execPortForwardCmd(fmt.Sprintf("pods/%s-genesis-0", chain.GetName()), port, remotePort))
}
}
// port-forward explorer
Expand Down Expand Up @@ -190,8 +190,8 @@ func (c *Client) CheckPortForward() error {

// check chain pods are running
for _, chain := range config.Chains {
if !strInList(pods, fmt.Sprintf("%s-genesis-0", chain.Name)) {
return fmt.Errorf("chain %s pod not found in running pods: %s", chain.Name, strings.Join(pods, ","))
if !strInList(pods, fmt.Sprintf("%s-genesis-0", chain.GetName())) {
return fmt.Errorf("chain %s pod not found in running pods: %s", chain.GetName(), strings.Join(pods, ","))
}
}
// check registry pods are running
Expand Down
5 changes: 5 additions & 0 deletions cmd/starship/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"strings"
)

type Chain struct {
Expand All @@ -15,6 +16,10 @@ type Chain struct {
Genesis map[string]interface{} `name:"genesis" json:"genesis,omitempty" yaml:"genesis"`
}

func (c *Chain) GetName() string {
return strings.Replace(c.Name, "_", "-", -1)
}

func (c *Chain) GetRPCAddr() string {
return fmt.Sprintf("http://localhost:%d", c.Ports.Rpc)
}
Expand Down

0 comments on commit b8b22ac

Please sign in to comment.