enhanced config debug print (dump w/o ES structs)

This commit is contained in:
2026-05-11 10:42:58 +02:00
parent 4194a004c0
commit d1d97fed1b

View File

@@ -24,6 +24,7 @@ import (
"net/http"
"os"
"github.com/alecthomas/repr"
"github.com/elastic/elastic-transport-go/v8/elastictransport"
"github.com/elastic/go-elasticsearch/v9"
"gopkg.in/yaml.v3"
@@ -108,6 +109,26 @@ func (conf *Config) Init() error {
}
}
conf.PrintDebug()
return nil
}
func (conf *Config) PrintDebug() error {
if !conf.Debug {
return nil
}
clone := *conf
for name := range clone.Clusters {
clone.Clusters[name] = nil
}
clone.DefaultCluster = nil
fmt.Println("config:")
repr.Println(clone)
return nil
}