Skip to content

Commit 72afa22

Browse files
committed
Show port configs
1 parent 1c3b90d commit 72afa22

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

cmd/debug/debug.go

+28
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ package debug
22

33
import (
44
"fmt"
5+
"log"
56
"os"
67
"path/filepath"
78
"regexp"
89
"sort"
910
"strings"
11+
"text/tabwriter"
1012

1113
"github.com/chia-network/go-chia-libs/pkg/config"
1214
"github.com/chia-network/go-modules/pkg/slogs"
@@ -47,11 +49,37 @@ var debugCmd = &cobra.Command{
4749
fmt.Println(strings.Repeat("-", 60)) // Separator
4850
network.ShowNetworkInfo()
4951

52+
fmt.Println("\n# Port Information")
53+
fmt.Println(strings.Repeat("-", 60)) // Separator
54+
debugPorts()
55+
5056
fmt.Println("\n# File Sizes")
5157
debugFileSizes()
5258
},
5359
}
5460

61+
func debugPorts() {
62+
cfg, err := config.GetChiaConfig()
63+
if err != nil {
64+
log.Println("Could not load config")
65+
return
66+
}
67+
68+
w := tabwriter.NewWriter(os.Stdout, 1, 1, 1, ' ', 0)
69+
_, _ = fmt.Fprintln(w, "Full Node Port\t", cfg.FullNode.Port)
70+
_, _ = fmt.Fprintln(w, "Full Node RPC\t", cfg.FullNode.RPCPort)
71+
_, _ = fmt.Fprintln(w, "Wallet RPC\t", cfg.Wallet.RPCPort)
72+
_, _ = fmt.Fprintln(w, "Farmer Port\t", cfg.Farmer.Port)
73+
_, _ = fmt.Fprintln(w, "Farmer RPC\t", cfg.Farmer.RPCPort)
74+
_, _ = fmt.Fprintln(w, "Harvester RPC\t", cfg.Harvester.RPCPort)
75+
_, _ = fmt.Fprintln(w, "Crawler RPC\t", cfg.Seeder.CrawlerConfig.RPCPort)
76+
_, _ = fmt.Fprintln(w, "Seeder Port\t", cfg.Seeder.Port)
77+
_, _ = fmt.Fprintln(w, "Data Layer Host Port\t", cfg.DataLayer.HostPort)
78+
_, _ = fmt.Fprintln(w, "Data Layer RPC\t", cfg.DataLayer.RPCPort)
79+
_, _ = fmt.Fprintln(w, "Timelord RPC\t", cfg.Timelord.RPCPort)
80+
_ = w.Flush()
81+
}
82+
5583
// debugFileSizes retrieves the Chia root path and prints sorted file paths with sizes
5684
func debugFileSizes() {
5785
chiaroot, err := config.GetChiaRootPath()

0 commit comments

Comments
 (0)