add support for config file and multiple clusters config (#1)

This commit is contained in:
T. von Dein
2026-04-27 09:11:10 +02:00
parent 496f4aeda3
commit 17f92874e5
7 changed files with 154 additions and 37 deletions

View File

@@ -42,7 +42,7 @@ type Snapshot struct {
func SnapshotList(conf *cfg.Config) error {
// get partial indicies
ires, err := conf.ES.Cat.Indices().Do(context.Background())
ires, err := conf.DefaultCluster.ES.Cat.Indices().Do(context.Background())
if err != nil {
return fmt.Errorf("Error getting indicies: %s", err)
}
@@ -55,7 +55,7 @@ func SnapshotList(conf *cfg.Config) error {
}
// get snapshots
sres, err := conf.ES.Cat.Snapshots().Do(context.Background())
sres, err := conf.DefaultCluster.ES.Cat.Snapshots().Do(context.Background())
if err != nil {
return fmt.Errorf("Error getting snapshots: %s", err)
}
@@ -103,7 +103,7 @@ func SnapshotList(conf *cfg.Config) error {
}
func SnapshotShow(conf *cfg.Config, snapshot string) error {
res, err := conf.ES.Snapshot.Get("*", snapshot).Do(context.Background())
res, err := conf.DefaultCluster.ES.Snapshot.Get("*", snapshot).Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get snapshot: %s", err)
}