check at bootstrap which cluster is reachable, fix current cluster

This commit is contained in:
2026-05-06 13:02:28 +02:00
parent af75bfa192
commit 8109481e23
3 changed files with 37 additions and 5 deletions

View File

@@ -75,12 +75,24 @@ func ClusterCompare(conf *cfg.Config, leader, follower string) error {
}
func ClusterList(conf *cfg.Config) error {
table := NewTable(2, len(conf.Clusters))
table.Addheaders("cluster", "uri")
table := NewTable(3, len(conf.Clusters))
table.Addheaders("cluster", "uri", "default")
idx := 0
for name, cluster := range conf.Clusters {
table.entries[idx] = []string{name, cluster.Uri}
current := name == "default" || name == conf.CurrentCluster
_, err := cluster.ES.Cluster.Health().
Header("content-type", "application/json").
Header("accept", "application/json").
Do(context.Background())
if err == nil {
name = Colorize("green", name)
}
table.entries[idx] = []string{name, cluster.Uri, fmt.Sprintf("%t", current)}
idx++
}