diff --git a/cmd/starship/connect.go b/cmd/starship/connect.go index b8a60cf0..61b8e039 100644 --- a/cmd/starship/connect.go +++ b/cmd/starship/connect.go @@ -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 @@ -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 diff --git a/cmd/starship/model.go b/cmd/starship/model.go index 3f8e880c..70b0d5f0 100644 --- a/cmd/starship/model.go +++ b/cmd/starship/model.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "strings" ) type Chain struct { @@ -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) }