Skip to content

Commit

Permalink
Use the port for the network defined in the config if its present (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmarslender authored Nov 13, 2024
1 parent 7dfab0e commit 31a380c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/network/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ var switchCmd = &cobra.Command{
if _, ok := cfg.NetworkOverrides.Constants[networkName]; !ok {
slogs.Logr.Fatal("selected network does not exist in config's network override constants", "network", networkName)
}
if _, ok := cfg.NetworkOverrides.Config[networkName]; !ok {
var (
netConfig config.NetworkConfig
ok bool
)
if netConfig, ok = cfg.NetworkOverrides.Config[networkName]; !ok {
slogs.Logr.Fatal("selected network does not exist in config's network override config", "network", networkName)
}

Expand Down Expand Up @@ -129,6 +133,10 @@ var switchCmd = &cobra.Command{
if bootPeer := viper.GetString("switch-bootstrap-peer"); bootPeer != "" {
bootstrapPeers = []string{bootPeer}
}
// If there is a port in the config, use that, but still allow the flag to be the final say
if netConfig.DefaultFullNodePort != 0 {
fullNodePort = netConfig.DefaultFullNodePort
}
if portFlag := viper.GetUint16("switch-full-node-port"); portFlag != 0 {
fullNodePort = portFlag
}
Expand Down

0 comments on commit 31a380c

Please sign in to comment.