mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 04:54:18 +02:00
get rid of getJsonPath, use flat_settings query flag instead (#66)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user