Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the port for the network defined in the config if its present #38

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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