get rid of getJsonPath, use flat_settings query flag instead (#66)

This commit is contained in:
T. von Dein
2026-07-03 10:25:57 +02:00
parent 1fc2004474
commit c9fb572935
4 changed files with 5 additions and 63 deletions

View File

@@ -20,7 +20,6 @@ import (
"context"
"encoding/json"
"fmt"
"log/slog"
"codeberg.org/scip/esctl/pkg/cfg"
"codeberg.org/scip/esctl/pkg/printer"
@@ -29,6 +28,7 @@ import (
func ClusterSettingsList(conf *cfg.Config) error {
res, err := conf.DefaultCluster.ES().Cluster.GetSettings().
FlatSettings(true).
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get cluster settings: %s", esErrorString(err))
@@ -48,19 +48,7 @@ func ClusterSettingsList(conf *cfg.Config) error {
}
for topic, val := range settingshash {
data := map[string]any{}
err := json.Unmarshal(val, &data)
if err != nil {
return fmt.Errorf("failed to unmarshall setting for topic %s: %s", topic, err)
}
paths := getJsonPath(map[string]string{}, data, topic)
slog.Debug("settings", topic, paths)
for setting, value := range paths {
entries = append(entries, []string{setting, fmt.Sprintf("%v", value)})
}
entries = append(entries, []string{topic, string(val)})
}
table.Entries = entries