milvus/cmd/tools/config/printer.go
SimFG 26f06dd732
Format the code (#27275)
Signed-off-by: SimFG <bang.fu@zilliz.com>
2023-09-21 09:45:27 +08:00

28 lines
481 B
Go

package main
import (
"fmt"
"os"
"sort"
"github.com/spf13/viper"
"go.uber.org/zap"
"github.com/milvus-io/milvus/pkg/log"
)
func ShowYaml(filepath string) {
reader := viper.New()
reader.SetConfigFile(filepath)
if err := reader.ReadInConfig(); err != nil {
log.Warn("read config failed", zap.Error(err))
os.Exit(-3)
}
keys := reader.AllKeys()
sort.Strings(keys)
for _, key := range keys {
v := reader.GetString(key)
fmt.Fprintln(os.Stdout, key, "=", v)
}
}